Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-10-2009
Member
 
Join Date: Oct 2009
Posts: 2
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:

Option Explicit
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,"
strOU ="CN=Users,"
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
Next

WScript.Echo "Users for " & strGroup & vbCr & strList

WScript.Quit



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.
Thank you.
Reply With Quote
  #2  
Old 12-10-2009
Member
 
Join Date: Oct 2009
Posts: 2
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:

Option Explicit
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
Next

WScript.Echo "Users for " & strGroup & ":" & vbCr & strList

WScript.Quit
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 07:55 PM.