sAMAccountName和区分大小写

时间:2013-08-05 15:59:50

标签: vbscript active-directory

我可以通过以下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。这可能吗?

1 个答案:

答案 0 :(得分:4)

sAMAccountName不区分大小写,因此如果strUserName的值为大写,小写或混合大小写,则无关紧要。