Can anyone tell me how do I export users a list of the users in an AD security group or distribution list to a txt file? Thanks for any information.
Can anyone tell me how do I export users a list of the users in an AD security group or distribution list to a txt file? Thanks for any information.
There is a VBScript that you can get from here - http://www.microsoft.com/technet/scr...4/hey1122.mspx
Or else, you can try to do the below:
dsquery group -name XXX > groups.txt
for /f "tokens=*" %%g in (groups.txt) do @echo %%g >>membership.txt && echo
Members: >>membership.txt && dsget group %%g -members -expand
membership.txt && echo ********************* >>membership.txt
You can try to open at a command prompt and type the following: net group <groupname> > report.txt
There is another way using csvde at a command prompt and type the below:
csvde -f report.txt -r (sAMAccountName=<groupname>) -l member
After that you can use VBScript when you have the Distinguished Name of the group:
Set objGroup = GetObject("LDAP://cn=TestGroup,ou=West,dc=MyDomain,dc=com")
For Each objMember in objGroup.Members
Wscript.Echo objMember.Name
Next
does anyone have sample script to list all the users from three OU in Active Directory ?
OU1, OU2, OU3 and export into txt file ?
Thanks in Advance
Bookmarks