# List AD group members



## night-fury (Nov 27, 2014)

Hi,

Can anyone help me how to get the list of members of an AD group in *csv or excel* etc. I don't understand, this being a very basic feature, why don't Microsoft introduce it by default.

-regards,
NF


----------



## TheShooter93 (Jul 10, 2008)

Hi *night-fury*,

This feature is built-in to Windows Server.

Right-click the Group you want to export a list of and choose *Export*.

You can save the list as tab-delimited or CSV.


----------



## night-fury (Nov 27, 2014)

TheShooter93 said:


> Hi *night-fury*,
> 
> This feature is built-in to Windows Server.
> 
> ...


Apologies, I wasn't clear enough. I can right click on the OU and it gives me the option to export. But I want to get the list of group members of a distribution group (distribution list).

I had this software earlier which used to pull the distribution groups from AD and was able to export the group members in excel file. It was called AD group members (its paid now), so since i was used to it, i wrote AD group instead of a DL/distribution group.


----------



## valis (Sep 24, 2004)

powershell.

https://social.technet.microsoft.co...-of-those-groups?forum=exchangesvradminlegacy


----------



## TheShooter93 (Jul 10, 2008)

Gotta love Powershell. :up:


----------



## peterh40 (Apr 15, 2007)

You can use Powershell commands to get list of group members:
e.g.

Import-module ActiveDirectory
Get-ADGroupMember -Identity cn=MyGroup,ou=MyOU,dc=mycompany,dc=com


----------



## night-fury (Nov 27, 2014)

peterh40 said:


> You can use Powershell commands to get list of group members:
> e.g.
> 
> Import-module ActiveDirectory
> Get-ADGroupMember -Identity cn=MyGroup,ou=MyOU,dc=mycompany,dc=com


i am getting an error, probably doin smthin wrong !

my AD structure is like this:
*domain:* abc.123.com
*ou:* my OU (there is a space in the two words, would that be a problem?)
*distribution group:* [email protected]


----------



## Triple6 (Dec 26, 2002)

You need to use quotes around them if there is a space in the OU.


----------



## night-fury (Nov 27, 2014)

I did try *with and without quotes* but getting an error:



> Get-ADGroupMember : Cannot convert 'System.Object[]' to the type 'Microsoft.ActiveDirectory.Management.ADGroup'
> required by parameter 'Identity'. Specified method is not supported.
> At line:1 char:19
> + Get-ADGroupMember cn=myGroup,ou=myOU,DC=123,DC=abc,DC=com
> ...


I, however, got an output with the below command:



> Get-ADGroupMember "MyGroup" | Where { $_.objectClass -eq "user" }


It includes quite a few lines for each user. Is it possible to get only the names with either:

*Import-module ActiveDirectory
Get-ADGroupMember -Identity cn=MyGroup,ou=MyOU,dc=mycompany,dc=com*
(if this works)

OR

*Get-ADGroupMember "MyGroup" | Where { $_.objectClass -eq "user" }*


----------

