【问题标题】:Get SAMAccountNames for all users in AD group获取 AD 组中所有用户的 SAMAccountNames
【发布时间】:2011-06-20 22:22:33
【问题描述】:

我正在寻找可以检索 Active Directory 组中所有成员的 SAMAccountNames 的 vbscript。

谢谢。

【问题讨论】:

    标签: windows vbscript active-directory ldap


    【解决方案1】:

    这是您要查找的脚本:

    '  Begining from a given group
    Dim strGrp
    strGrp = "cn=g1,ou=ou,dc=societe,dc=fr"
    Set objGroup = GetObject ("LDAP://"& strGrp)
    objGroup.getInfo
    
    arrMemberOf = objGroup.GetEx("member")
    
    ' Loop = For Each .... Next 
    ' WScript.Echo "Members of Group "
    For Each strMember in arrMemberOf
       WScript.echo strMember
       Set objUser = GetObject ("LDAP://"& strMember)
       sAMAccountName = objUser.GetEx("sAMAccountName")
       WScript.echo sAMAccountName(0)
    Next
    Wscript.Quit
    

    Here is a site where you can get help.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-10
      • 1970-01-01
      • 1970-01-01
      • 2017-06-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多