Question

Locked

AD how to get a listing of security groups?

By isla23 ·
I am having to trawl through the properties and security groups and then type out each individual group. Is there an easy way to do this that i could employ. If anyone can help i would be a very happy bunny!

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Only way is scripting it seems..

by Fred123456 In reply to AD how to get a listing o ...

As far as I know your going to have write a VB script that will enumerate through the groups container and then list each memeber of the group.

For example:
Option Explicit
Dim objRootLDAP, objGroup, objUser, objOU, objmemberOf
Dim strOU, strUser, strDNSDomain, strLDAP, strList

' Commands to bind to AD and extract domain name
Set objRootLDAP = GetObject("LDAP://RootDSE")
strDNSDomain = objRootLDAP.Get("DefaultNamingContext")

' Build the LDAP DN from strUser, strOU and strDNSDomain
strUser ="cn=Administrator,"
strOU ="CN=Users,"
strLDAP ="LDAP://" & strUser & strOU & strDNSDomain

Set objUser = GetObject(strLDAP)

' Heart of the script, extract a list of Groups from memberOf
objmemberOf = objUser.GetEx("memberOf")
For Each objGroup in objmemberOf
strList = strList & objGroup & vbcr
Next

WScript.Echo "Groups for " & strUser & vbCr & strList

WScript.Quit

' End of Sample User memberOf VBScript

Collapse -

Only way is scripting it seems..

by Fred123456 In reply to AD how to get a listing o ...

Double posted..

Back to Security Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums