Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Rugby-Ball/c728f4d5eee3a87597e6439707858507 to your computer and use it in GitHub Desktop.

Select an option

Save Rugby-Ball/c728f4d5eee3a87597e6439707858507 to your computer and use it in GitHub Desktop.
This will get all of the Computers in an AD, and display the Server name, the Distinguished Name and the Groups the computer is a Member of. (groups they are in) #Inventory #Active_Directory
#This will get all of the Computers in an AD, and display the Server name, the Distinguished Name and the Groups the computer is a Member of. (groups they are in)
((Get-ADComputer -Filter *).samaccountname).trimend("$") | Get-ADComputer -Properties memberOf | Select-Object -Property @{N= "Name";E= {($_.samaccountname).trimend("$")}}, @{N= "Distinguished_Name";E= {$_.DistinguishedName}}, @{N= "Groups";E={$_.Memberof}} | Sort Name | Out-GridView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment