Every system admin gets request to send list of group members from all kinds of users. It’s very easy if you know how to search Internet (Bing! anyone).
Long back I posted VBScript to list the group members. Check here: https://anandthearchitect.wordpress.com/2008/10/18/get-members-list-from-a-domain-group-by-vbscript/
While back I posted an blog to list the AD group members using DSQuery command in Command Prompt. Check Here: https://anandthearchitect.wordpress.com/2009/12/02/get-active-directory-group-member-list/
Now we have the handy dandy power shell and Active Directory Module on latest version of Windows. Here is how you can list the group members using power shell.
1. Launch power shell
2. Import the AD module by typing
3. Type this command: (replace “finance” with your “AD group name”)
Get-ADGroupMember "finance" | Format-Table Name, samaccountname
Now the explanation. Get-ADGroupMember get the list of members on the specified group. We pipe that into Format-Table cmdlet which will display the results in table format. I only want Full Name and UserName of the member details.
4 thoughts on “Power shell: How to list group members?”
I tried doing this and it provides results for all groups that are under my systems domain. When I try doing this for the groups that belong to another domain I get the error that :
Get-ADGroupMember -Identity “US\sgDataServices_QA”
Get-ADGroupMember : Cannot find an object with identity: ‘sgDataServices_QA’ under: ‘DC=clarica,DC=com’.
The account “US\sgDataServices_QA” is from US domain and I belong to ML domain in India.
I am a DBA by job so do not have much knowledge on AD, hope you have some advice for me.
I got mine to work by doing the following:
Get-ADGroupMember finance | Get-ADUser | Select-Object SamAccountName, GivenName, Surname
To query the group member from another domain add -server:
Get-ADGroupMember “finance” -server domainname.com
This excellent website really has all the information and facts I
needed concerning this subject and didn’t know who to ask.