Vbscript 使用字符串作为对象方法

Vbscript 使用字符串作为对象方法,vbscript,active-directory,Vbscript,Active Directory,基本上,我正在创建一个小脚本来更新广告属性(对于超级用户,而不是管理员) 我有很多属性,但我需要一个自定义字段,这样用户就可以输入AD属性,然后通过LDAP查询对其进行搜索,并使用objUser显示 代码如下: Do While z = True attrchoice = InputBox("Please enter the custom attribute you wish to edit", "Custom Attribute") MsgBox "You have selec

基本上,我正在创建一个小脚本来更新广告属性(对于超级用户,而不是管理员)

我有很多属性,但我需要一个自定义字段,这样用户就可以输入AD属性,然后通过LDAP查询对其进行搜索,并使用objUser显示

代码如下:

Do While z = True
    attrchoice = InputBox("Please enter the custom attribute you wish to edit", "Custom Attribute")
    MsgBox "You have selected " & objUser.+attrchoice, vbOKOnly+vbInformation, objUser.displayName
    On Error Resume Next
    If Err.Number <> 0 Then
        MsgBox "Error!" & vbCrlf & "Attribute cannot be found, please try again", vbOKOnly+vbExclamation, "Error"
    Else
        z = false
    End If
    On Error Goto 0

Loop
只要使用这个函数

strValue = objUser.Get(attrchoice)

我看到您以后已经在使用
Put()
函数为属性赋值了。这很相似,但正好相反。

这是一个键!非常感谢,现在都在工作。今天也学习了Get()。)
strValue = objUser.Get(attrchoice)