Using Powershell to Export Group Members from Active Directory
As the title suggests, I will be showing how to export members of a group from Active Directory to a spreadsheet.
Get all the modules:
First, make sure you have the Active Directory module:
Finding AD Group:
This will output all the ad group. The wild card is only in place in case you don’t know the group name you’re looking for.
Get-adgroup -filter * | sort name | select name
Listing AD Group Members:
This will list all the users within that Group.
Get-AdGroupMember -identity Group_Name
If you want to just get the member name
Get-AdGroupMember -identity "Group_Name" | select name
Exporting Group Members to CSV File:
Will export the group members to a excel sheet on the path specified above.
Get-AdGroupMember -identity "Group_Name" | select name | Export-csv -path C:\Users\Desktop\Group_Name.csv -NoTypeInformation