Use Case
Exporting list of distribution group members for review.
Export Active Directory group membership from a single group to CSV
Directions
- Change “Name of Group” to the actual group name
- Specify a valid export path and filename. Ensure the folder exists
PowerShell One-Liner Command
Get-ADGroupMember -identity “Name of Group” | select-object name | Export-csv -path C:\Export\GroupMembers.csv -NoTypeInformation
Export membership of multiple Active Directory Groups. Input CSV; export to separate CSV’s
Directions
- Specify a valid CSV path for import. Ensure the column header in the input CSV reads “Groups”, as shown below:

- Specify a valid export path. Ensure the folder exists. Don’t include a trailing “\” in the export path
Script
$Date = Get-Date -UFormat "%m-%d-%Y-%R"
$CSV = import-CSV "C:\temp\Groups.csv"
$ExportPath = "C:\Temp\Groups"
foreach ($Group in $CSV.Groups)
{
Get-ADGroupMember -identity $Group | Select-Object name | Export-csv -path $ExportPath\$Group-$Date.csv -NoTypeInformation
}
Additional Notes
- Command\script will return list of users, computers, and groups that are a member of a group.