> For the complete documentation index, see [llms.txt](https://capcap-1.gitbook.io/capcap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capcap-1.gitbook.io/capcap/readme/ctf-modules/information-gathering/service-enumeration/windows-remote-management-protocols/winrm-5985-5986.md).

# WinRM (5985, 5986)

Use this page to enumerate WinRM and connect when you have valid credentials.

### WinRM (Windows Remote Management)

WinRM is a command-line oriented system automation framework based on the standardized Web-Based Enterprise Management (WBEM) protocol specifications.

### Architecture and data pipelines

* **Communication layer** — utilizes the SOAP (Simple Object Access Protocol) data model structure to process management commands via XML text sequences.
* **Network port mappings** — listens by default on TCP port `5985` for HTTP and TCP port `5986` for HTTPS.
* **Integration features** — serves as the primary operational engine processing remote PowerShell sessions and automated corporate Event Log collection tasks. It interacts seamlessly with WinRS (Windows Remote Shell) to run quick, isolated terminal tasks on network targets.
* **Platform inclusions** — turned on natively across all server setups beginning with Windows Server 2012.

### Footprinting and execution shell syntax

#### Port discovery

```bash
sudo nmap -sV -sC -p 5985,5986 --disable-arp-ping -n <TARGET_IP>
```

#### Querying WS-Management targets via PowerShell

```powershell
# Native validation execution command inside a Windows client context
Test-WsMan -ComputerName <TARGET_IP>
```

#### Exploiting WinRM contexts via Linux terminal

If valid local or domain user account strings are acquired, use `evil-winrm` to land a fully interactive administrative PowerShell shell instance:

```bash
evil-winrm -i <TARGET_IP> -u <username> -p <password>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://capcap-1.gitbook.io/capcap/readme/ctf-modules/information-gathering/service-enumeration/windows-remote-management-protocols/winrm-5985-5986.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
