Pages

Monday, June 2, 2014

Export Active Directory Group Membership to CSV

Using Windows PowerShell you can easily export Active Directory group membership to CSV. First, start Windows PowerShell as an administrator and import the Active Directory PowerShell module.
Import-Module ActiveDirectory
Next, run the below command where "GroupName" is the name of the group you want to export the membership list.
Get-ADGroupMember -identity “GroupName” | select name | Export-csv -path "C:\results.csv" -NoTypeInformation
If you have nested groups you will see the nested groups and not the members of those groups in the results.csv. If you want the members of those groups exported use the command below.
Get-ADGroupMember -identity “GroupName” -recursive | select name | Export-csv -path "C:\results.csv" -NoTypeInformation
If you have a question or would like to make a request for something you would like to see on my blog feel free to reach out to me.