根据提供的用户名检索AD属性

时间:2015-08-14 19:57:22

标签: vbscript

我有一个函数(下面)可以提供我需要的AD属性(名字和姓氏)与当前登录的用户,但我想要的是用户输入用户名,将其传递给此函数,并根据传递的用户名查找名字和姓氏。

Function ADFullName(strName)

    Dim objSysInfo, objUser, strRet
    Set objSysInfo = CreateObject("ADSystemInfo")

    ' Currently logged in User
    Set objUser = GetObject("LDAP://" & objSysInfo.UserName)

    strRet = msgbox("If this is your full name, click yes to proceed, otherwise click NO and re-enter your new username:" & vbclf & vbclf & objUser.FirstName & " " & objUser.LastName, vbYesNo, "Confirm Name")

    If strRet = vbYes Then
        Msgbox "You answered yes."
    Else
        Msgbox "You answered no."
    End If

End Function

0 个答案:

没有答案
相关问题