Link to home
Start Free TrialLog in
Avatar of hyperbyte
hyperbyteFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Export Members of an Active Directory Group To CSV on Server 2008

Hello,

I need to export a list of members that are part of an Active Directory Global Security Group to a CSV file?  How can I do this?  I am running Server 2008 Standard.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of ienaxxx
ienaxxx
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Will Szymkowski
Use powershell for this...

Get-adgroupmember -identity "name of group" / select name, sAMAccountName / export-csv "c:/security-export.csv"

The forward slashes should be pipe command I don't have this icon on my phone but that should do the trick for you.

Hope this helps
or you can use the good old csvde with an LDAP FILTER

csvde -r "(&(objectClass=User)(memberof=CN=myDesiredGroup,OU=myGroupsOU,OU=myOU,DC=myDOMAIN,DC=local))" -f myCSV.csv

Open in new window

or the good old dsget:

dsquery group -name myGroupName | dsget group -members

Open in new window

but the first powershell and the last dsget can be recursive, if you want, with -recurse and -expand respectively.
You can achieve these through AD manager plus provide by manage engine. It's free for 30 days trail.

For more info and download, refer below link :

http://www.manageengine.com/products/ad-manager/
Avatar of hyperbyte

ASKER

Hi, thanks for the responses.  My powershell knowledge is not very good.  I'm looking for a script I can copy and paste into powershell, replacing "name of group" for my AD Group but I get errors saying Get-adgroupmember is not a recognised as the name of a cmdlet check line 1 character 18.

Get-adgroupmember -identity "name of group" | select name, sAMAccountName | export-csv "c:/security-export.csv"
you have to use
import-module ActiveDirectory

before, as i told you.
:-)
Avatar of w_richard
w_richard

Hi,
 
To identify members of a local group by using a command line, refer to:
 
1. Open Command Prompt.
2. To list members of a group, type: net localgroup "groupname"
 
Note: You must include the quotation marks.
 
For example, export the members of the local group Administrators to a text file named group.txt, refer to:
 
net localgroup “Administrators” > C:\group.txt

Moreover you can have a look at this link..

http://goo.gl/0b0ouA

Thanks.
Hi Richard,
 He's asking for querying Active Directory groups.