Nested Groups ... multiple domains
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Nested Groups ... multiple domains

 
Post new topic   Reply to topic    Windows Server Forum Index -> Active Directory
Author Message
Mark
Guest





Posted: Thu Nov 10, 2005 5:51 pm    Post subject: Nested Groups ... multiple domains Reply with quote

Hi All,

I need to find something that will show me the members and nested members of
distribution groups in AD. I found a script that does this here
http://www.windowsitpro.com/WindowsScripting/Article/ArticleID/41500/41500.html
Don't think any of my users know what a distinguished name is so I have
modified the script a little bit so that they just have to type in the CN of
the group ... see below. My problem is that this works fine for one domain
but we have 5 domains in our tree. Can someone help me get this script to
check for the group in one; If it fails ... to then move onto the next
domain. Either that or if you now an app\script that connects to Outlook and
does a similar thing. Any help would be very much appreciated.

Thanks,

Mark

-----------------------------------------------------------------------

option explicit
Dim objRootDSE, strGroupDN, GroupMembers
Dim strGroup, strSearchDN, objFs, Txtfile
Set objFs = CreateObject("Scripting.FileSystemObject")
Set Txtfile = objFs.CreateTextFile("c:\Nested_Group_Members.txt", True)
set objRootDSE = GetObject("LDAP://RootDSE")
strSearchDN = ",OU=Groups," & objRootDSE.Get("defaultNamingContext")
strGroup = InputBox("Enter the Group Name you would like to audit", "Nested
Groups Audit", "Group Name Here")
If strGroup = "" or strGroup = "Group Name Here" Then
Msgbox "You have not entered a value or Cancelled ... Bye !! ", vbOKonly +
vbcritical, strTitle
Wscript.Quit
End If
strGroupDN = "CN=" & strGroup & strSearchDN
Txtfile.WriteLine "Members of " & strGroupDN
Txtfile.WriteBlankLines 1
set GroupMembers = CreateObject("Scripting.Dictionary")
DisplayMembers "LDAP://" & strGroupDN, " ", GroupMembers
Wscript.Echo "Done !!"

Function DisplayMembers (strGroupDN, strSpaces, GroupMembers)
Dim objGroup, objMember
set objGroup = GetObject(strGroupDN)
for each objMember In objGroup.Members
Txtfile.WriteLine "" & objMember.Get("cn")
if objMember.Class = "group" then
if GroupMembers.Exists(objMember.ADsPath) then
'Wscript.Echo strSpaces & " ^ already seen group member " & "(stopping to
avoid loop)"
else
GroupMembers.Add objMember.ADsPath, 1
DisplayMembers objMember.ADsPath, strSpaces & " ", GroupMembers
end if
end if
next
End Function

-----------------------------------------------------------------------
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Active Directory All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB