Results 1 to 2 of 2

Thread: VB. List the userID from group (Domain Admins set as Primary group)

  1. #1
    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.

  2. #2
    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

Similar Threads

  1. adding another domain user as domain admins group
    By Billie in forum Active Directory
    Replies: 3
    Last Post: 19-07-2010, 06:57 PM
  2. Add user in freebsd to secondary group not primary group
    By FreeBSD in forum Operating Systems
    Replies: 3
    Last Post: 11-08-2009, 06:38 PM
  3. Builtin\administrators group vs domain admins group
    By weaverbeaver in forum Windows Server Help
    Replies: 4
    Last Post: 14-01-2009, 05:07 AM
  4. Replies: 2
    Last Post: 04-07-2008, 06:10 AM
  5. Replies: 1
    Last Post: 27-06-2008, 03:59 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,157,551.50351 seconds with 17 queries