> For the complete documentation index, see [llms.txt](https://book.ice-wzl.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.ice-wzl.xyz/recon-enumeration/pentesting-winrm.md).

# Pentesting WinRM

## Overview

* Windows Remote Management
* Ports: TCP 5985 (HTTP), TCP 5986 (HTTPS)
* Uses SOAP-based XML protocol
* Integrated into PowerShell Remoting

## Scanning

```
nmap -sV -sC 10.129.201.248 -p5985,5986 --disable-arp-ping -n
```

## Evil-WinRM

```
evil-winrm -i 10.129.201.248 -u Cry0l1t3 -p P455w0rD!
```

## Validate Access with NetExec

```bash
netexec winrm TARGET -d DOMAIN.LOCAL -u USER -p 'PASSWORD'
netexec winrm TARGET -u LOCALUSER -H NTLM_HASH --local-auth
```

For paired username/password lists, avoid accidental password spraying by using `--no-bruteforce`:

```bash
netexec winrm targets.txt -d DOMAIN.LOCAL -u users.txt -p passwords.txt --no-bruteforce
```

Valid RDP credentials do not guarantee WinRM access. WinRM requires the account to be allowed to use PowerShell remoting, so test both protocols separately.

## PowerShell Test

```powershell
Test-WsMan <hostname>
```

## WMI (TCP 135)

* Windows Management Instrumentation
* Uses TCP 135 for initial connection, then random high port
* Allows reading/writing to all Windows settings, triggering actions, remote code execution

### WMIexec.py (Impacket)

```
/usr/share/doc/python3-impacket/examples/wmiexec.py Cry0l1t3:"P455w0rD!"@10.129.201.248 "hostname"
```


---

# 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://book.ice-wzl.xyz/recon-enumeration/pentesting-winrm.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.
