> For the complete documentation index, see [llms.txt](https://infra.newerasec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infra.newerasec.com/infrastructure-testing/privilege-esclation/situational-awareness/windows.md).

# Windows

| Domain                                    | Comment                          |
| ----------------------------------------- | -------------------------------- |
| net view                                  | list computers on domain         |
| net view \\\\\<target name>               | list shares on host              |
| net view /domain                          | list domains                     |
| net view /domain:\<domain name>           | list computers on a named domain |
| net users \<username> \<password> /add    | add user                         |
| net localgroup Administrators \<username> | add to administrators group      |
| nltest /dclist:\<domain name>             | Domain Controllers list          |

### **User details:**&#x20;

`Whoami`&#x20;

`hostname`&#x20;

`Echo %username%`&#x20;

`Net users`&#x20;

`Net user USERNAME`&#x20;

### **Get Windows User and Domain Information**&#x20;

`set`&#x20;

`whoami /all`&#x20;

`Get-ADTrust`

### **Information on current domain:**

Domain information:

`[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()`

Domain Trusts:

`([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).GetAllTrustRelationships()`

Current forest info:

`[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()`

Trust relationship:

`([System.DirectoryServices.ActiveDirectory.Forest]::GetForest((New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext('Forest', 'forest-of-interest.local')))).GetAllTrustRelationships()`

**Get current privileges:**&#x20;

`whoami /priv`&#x20;

**Show routes:**&#x20;

`route print`&#x20;

**Enumerate local administrators**&#x20;

`net localgroup administrators`&#x20;

**Check for missing patches:**&#x20;

`wmic qfe get Caption,Description, HotFixID,InstalledOn`&#x20;

**get DCs of a domain**&#x20;

`net group "domain controllers" /domain`&#x20;

**Launch a cmd prompt as another user:**&#x20;

`runas /netonly /user:[Domain]\[username] cmd.exe`&#x20;

**Get windows version:**&#x20;

`ver`&#x20;

**Systeminfo:**&#x20;

`systeminfofindstr/B /C:"OS Name" /C:"OS Version`&#x20;

**View password policy:**&#x20;

`net accounts`&#x20;

On DC:

`Get-ADDefaultDomainPasswordPolicy`&#x20;

**List Drives:**

`gdr -PSProvider 'FileSystem'`

Or

`[System.IO.DriveInfo]::GetDrives() | Format-Table`


---

# 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:

```
GET https://infra.newerasec.com/infrastructure-testing/privilege-esclation/situational-awareness/windows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
