# Enumerating OUs

### PowerView

Get OUs from current domain with LDAP ADs path

```
Get-NetOU
```

Get OUs from another domain with LDAP ADs path

```
Get-NetOU -Domain <DOMAIN NAME>
```

Get OUs from current domain with all properties

```
Get-NetOU -FullData
```

Get OUs from another domain with all properties

```
Get-NetOU -Domain <DOMAIN NAME> -FullData 
```

Get list of computers from specific OU of current domain

```
Get-NetOU <OU NAME> | %{Get-NetComputer -ADSPath $_ }
```

Get gplink of all OUs from current domain

```
(Get-NetOU -FullData).gplink.split(";")[0] -replace "^." | 
```

Get gplink of all OUs from another domain

```
(Get-NetOU <OU NAME> -FullData).gplink.split(";")[0] -replace "^." 
```

### Active Directory Module

Get OUs from current domain with default properties

```
Get-ADOrganizationalUnit -Filter * 
```

Get OUs from another domain with default properties

```
Get-ADOrganizationalUnit -Filter * -Server <DOMAIN NAME>
```

Get OUs from current domain with all properties

```
Get-ADOrganizationalUnit -Filter * -Properties *
```

Get OUs from another domain with all properties

```
Get-ADOrganizationalUnit -Filter * -Properties * -Server <DOMAIN NAME>
```
