Get AD Group Memberships of all Users in a OU
Posted on 2014-08-27
I am doing my first steps in powershell and am already a bit stuck on an issue,
I am trying to get a list of all Users in a OU and there Group memberships to a file that I can Import in to excel
My initial try was:
PS C:\> Get-ADUser -LDAPFilter "(name=*)" -SearchScope Subtree -SearchBase "OU=users,OU=Paris,DC=Contoso,DC=North,DC=Com" | Get-ADPrincipalGroupMembership | select name | Out-File -FilePath C:\Temp\ADExtract.txt
And I do get a List of all Group Memberships for each user but unfortunately the output is unusable since I cannot tell which user account the group membership belongs to.
Any help much appreciated