Active Directory Powershell : Get all members of a nested group and export to csv

Active Directory Powershell : Get all members of a nested group and export to csv

·

1 min read

"Group-Name" = change to whatever group you wish to report members on, the '-recursive' option ensures that members of all nested groups are included.

"All-Group-Members.csv" = file that is created and populated with the results of the query (username, mail).

Get-ADGroupMember -Identity "Group-Name" -recursive |
    Get-ADUser -Properties Mail |
    Select-Object name, mail | 
    Export-Csv C:\All-Group-Members.csv -NoTypeInformation