Export AD Group Members

One common request I see is getting a list of users that belong to an Active Directory security group. This is requested for various reasons such as, supervisor wants to know who has access to a folder, auditor wants a list of users, 3rd party program or cloud service needs to import a list of users from a csv file.

The problem is…

The built in Active Directory users and Computer tool has no option to export members from a group.

To accomplish this we can use PowerShell.

In this tutorial, I will walk through the steps for exporting group members to a csv file

$properties = ‘GivenName’, ‘Surname’, ‘samaccountname’ , ‘initials’ , ’emailaddress’ , ‘company’ , ‘department’ , ‘title’ , ‘city’
get-AdGroupMember -identity “sabreusers” | Get-ADUser -Property $properties | select $properties | Export-csv -path C:\members.csv -NoTypeInformation

hasilnya adalah :

GivenName : hadi
Surname : utomo
samaccountname : hadi.utomo
initials : ABC101
emailaddress : hadi.utomo@abc.com
company : ABC
department : Production

Leave a Reply

Your email address will not be published. Required fields are marked *