Subtree issue/question

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
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.
This topic is 15 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
new_user
Posts: 157
Last visit: Tue May 06, 2014 5:46 pm

Subtree issue/question

Post by new_user »

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
This topic is 15 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked