2

我可以通过以下 vbs 代码获取特定 ADS 用户的用户详细信息。

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection

objCommand.CommandText = _
    "<LDAP://"& objDomain.Get("distinguishedName") &">;" & _
    "(&(objectclass=user)(objectcategory=person)(sAMAccountName=" & strUserName & "));" & _
    "cn,displayName;subtree"
objCommand.Execute

LCase与. sAMAccountName_ strUserName这可能吗?

4

1 回答 1

5

sAMAccountNamestrUserName不区分大小写,因此 的值是大写、小写还是混合大小写都无关紧要。

于 2013-08-05T18:17:53.450 回答