# GPO & OU Enumeration

### **GPO Enumeration**

**Get list of GPO in current Domain**

{% code overflow="wrap" %}

```powershell
Get-DomainGPO
Get-DomainGPO -ComputerIdentity dcorp-student1
```

{% endcode %}

\*\*Get GPOs which use Restricted Groups or groups.xml for interesting users

{% code overflow="wrap" %}

```powershell
Get-DomainGPOLocalGroup
```

{% endcode %}

**Get users which are in a local group of a machine using GPO**

{% code overflow="wrap" %}

```powershell
Get-DomainGPOComputerLocalGroupMapping -ComputerIdentity dcorp-student1
```

{% endcode %}

**Get machines where the given user is member of a specific group**&#x20;

{% code overflow="wrap" %}

```powershell
Get-DomainGPOUserLocalGroupMapping -Identity student1 - Verbose
```

{% endcode %}

### OU Enumeration

**Get OUs in a domain**

{% code overflow="wrap" %}

```powershell
Get-DomainOU
Get-ADOrganizationalUnit -Filter * -Properties *
```

{% endcode %}

**Get GPO applied on an OU. Read GPOname from gplink attribute from Get-NetOU**

{% code overflow="wrap" %}

```powershell
Get-DomainGPO -Identity "{0D1CC23D-1F20-4EEE-AF64-
D99597AE2A6E}"
```

{% endcode %}


---

# Agent Instructions: 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://playbook.sidthoviti.com/active-directory-pentest/domain-enumeration/gpo-and-ou-enumeration.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.
