Exporting Active Directory Group to a Text File

W

wk

Hi
I would like to extract the login ids and names of
members in a group.

I know there is an export function for ou.
Is there also an export function for groups.

Can anyone tell me how?
 
J

Jimmy Andersson

This will list the group members in the domain admins group, edit it
accordingly to your needs and send the output to a file instead of the
screen if you want.

<snip>
Set rootDSE = GetObject("LDAP://rootDSE")
domainContainer = rootDSE.Get("DefaultNamingContext")

Set grp = GetObject("LDAP://CN=domain admins,CN=users," & domainContainer)
Set mList = grp.members
For Each member In mList
WScript.Echo member.Name
Next
<snip>

Regards,
/Jimmy
 
M

mark

Off the top of my head...

you can run the command

net group GROUPNAME /domain

(make sure you actually type the word domain and not your
domain name)

Just pipe it out to a text file i.e.

net group GROUPNAME /domain > newfile.txt

Will only give you usernames though - not fuill names
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top