PowerShell: List Members of AD Security Group

The below PowerShell code will get all users that are members of the specified Security Group. Two output methods are available, on screen and export to CSV file.

Replace the asterisk (*) with the Security Group in question.

 

Display on Screen:
Get-ADGroupMember -identity "*" | Select Name
Export to CSV:
Get-ADGroupMember -identity "*" | Select Name | Export-CSV -Path C:\Windows\Temp\SecurityGroups.csv -NoTypeInformation
Export to CSV on Network Drive:
Get-ADGroupMember -identity "*" | Select Name | Export-CSV -Path "\\Server\Audit\SecurityGroups.csv" -NoTypeInformation

Leave a Reply