What is the easiest way to rewrite or modify this so it searches for all users not just the OU is "coded" for. Stuck between ADSI and WINNT with this. This code searches for users objects and lists all groups they are a member of.
Thank you in advance for the help.
On Error resume Next
Const E_ADS_PROPERTY_NOT_FOUND = &h8000500DConst ADS_SCOPE_SUBTREE = 2
Set objOU = GetObject _ ("LDAP://dc=domain,dc=com") ObjOU.Filter= Array("user") For Each objUser in objOU WScript.Echo objUser.cn & " is a member of: " 'WScript.Echo vbTab & "Primary Group ID: " & _ objUser.Get("primaryGroupID") arrMemberOf = objUser.GetEx("memberOf") If Err.Number <> E_ADS_PROPERTY_NOT_FOUND Then For Each Group in arrMemberOf WScript.Echo vbTab & Group Next Else WScript.Echo vbTab & "memberOf attribute is not set" Err.Clear End If Wscript.Echo Next
Subtree issue/question
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.