VB. List the userID from group (Domain Admins set as Primary group)
Hello everyone. I have the following case: when I trying to collect all userIDs from the specific group Domain Admins, then the UserID which have been set as Primary Group for Domain Admins not listening:
VB Script code:
Dim objRootLDAP, objGroup, objUser, objOU, objmemberOf
Dim strOU, strGroup, strDNSDomain, strLDAP, strList, strUser
Set objRootLDAP = GetObject("LDAP://RootDSE")
strDNSDomain = objRootLDAP.Get("DefaultNamingContext")
strGroup ="cn=Domain Admins,"
strLDAP ="LDAP://" & strGroup & strOU & strDNSDomain
Set objGroup = GetObject(strLDAP)
For Each strUser in objGroup.Member
Set objUser = GetObject("LDAP://" & strUser)
strList = strList & objUser.CN & vbcr
WScript.Echo "Users for " & strGroup & vbCr & strList
But when the Primary group for the UserID have been set to Domain Users then the UserID collecting with the code above.
I welcome any suggestions.
Re: VB. List the userID from group (Domain Admins set as Primary group)
I have found the issue: LDAP did not listening the Primary Group. So I have used the WinNT:
Dim objRootLDAP, objGroup
Dim strOU, strGroup, strDNSDomain, strNT, strList, strUser
strDNSDomain = "CASE1"
strGroup = "Domain Admins"
strNT ="WinNT://" & strDNSDomain & "/" & strGroup
Set objGroup = GetObject(strNT)
For Each strUser in objGroup.Members
strList = strList & strUser.Name & vbcr
WScript.Echo "Users for " & strGroup & ":" & vbCr & strList
|Tags: admins, group, primary, userid|
|Thread Tools||Search this Thread|
|Similar Threads for: "VB. List the userID from group (Domain Admins set as Primary group)"|
|Thread||Thread Starter||Forum||Replies||Last Post|
|adding another domain user as domain admins group||Billie||Active Directory||3||19-07-2010 06:57 PM|
|Add user in freebsd to secondary group not primary group||FreeBSD||Operating Systems||3||11-08-2009 06:38 PM|
|Builtin\administrators group vs domain admins group||weaverbeaver||Windows Server Help||4||14-01-2009 05:07 AM|
|Adding group/user to local Admins group on all workstations?||IJAYA||Window 2000 Help||2||04-07-2008 06:10 AM|
|GPO Delegation "Apply Group Policy" deny for Domain admins does not work?||MilesAway||Small Business Server||1||27-06-2008 03:59 PM|