Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vbscript 根据提供的用户名检索广告属性_Vbscript - Fatal编程技术网

Vbscript 根据提供的用户名检索广告属性

Vbscript 根据提供的用户名检索广告属性,vbscript,Vbscript,我有一个函数(如下),可以为当前登录的用户提供我需要的广告属性(名字和姓氏),但我希望用户输入用户名,将其传递给此函数,并根据传递的用户名查找名字和姓氏 Function ADFullName(strName) Dim objSysInfo, objUser, strRet Set objSysInfo = CreateObject("ADSystemInfo") ' Currently logged in User Set objUser = GetObje

我有一个函数(如下),可以为当前登录的用户提供我需要的广告属性(名字和姓氏),但我希望用户输入用户名,将其传递给此函数,并根据传递的用户名查找名字和姓氏

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