Like the write up I did on how to get a list of users in your domain, there are several ways to do this, but the method I prefer to use is get-QADGroupMember command from the Quest Active Server Roles PowerShell module.
- Start the ‘ActiveRoles Management Shell for Active Directory’ console
- Enter the following command string
Get-QADGroupMember -sizelimit 0 'MyDomain\My AD Group Name' | Select-Object sAMAccountName, DisplayName
- and then press Enter
SamAccountName DisplayName
DaggF Fred Dagg
CollinsP Paul Collins
SprouleK Ken Sproule
ReithP Peter Reith
SmithC Coach Smith
RookeM Mike Rooke
Or if I want to dump it out to a CSV file, so I can look at it in Excel:
Get-QADGroupMember -sizelimit 0 'MyDomain\My AD Group Name' | Select-Object sAMAccountName, DisplayName | Export-CSV 'c:\temp\My AD Group Name.csv'
To dump all the user details out, you could doing something like:
get-QADGroupMember -sizelimit 0 -IncludeAllProperties -SerializeValues 'MyDomain\My AD Group Name' | Export-CSV 'c:\temp\My AD Group Name-ALL Details.csv'
Note(s):
- This will ONLY get the direct members of a group. It will not get members of a AD group that is in the AD group you are trying to list out.
- If you are querying a different domain, you need to connect to it first. ie. connect-QADService -service ‘MyDomain’