OUs

Get OUs in a Domain

# AD Module
Get-ADOrganizationalUnit -Filter * -Properties *

# PowerView
Get-NetOU -FullData
# AD Module
Get-GPO -GUID "AB306569-220D-43FF-B03B-83E8F4EF8081"

# PowerView
Get-NetGPO -GPOname "{AB306569-220D-43FF-B03B-83E8F4EF8081}"

Find All Computers in a given OU

Get-DomainComputer -SearchBase "ldap://OU=..."

Get the Logged on Users for All Machines in Any server OU in a Particular Domain

Get-DomainOU -Identity *server* -Domain <domain> | %{Get-DomainComputer -SearchBase $_.distinguishedname -Properties dnshostname | %{Get-NetLoggedOn -ComputerName $_}}

Last updated