我正在尝试将域用户帐户添加到本地组,如果我登录到计算机,一切正常但如果我在SYSTEM帐户下运行相同的脚本则会失败,并显示错误:424 Object Required“。是代码:
Dim domain : domain = "DOMAIN01"
Dim domainController: domainController = "99.139.151.102"
Dim localComputer : localComputer = "SERVER001"
Dim localGroup : localGroup = "LocalGroup1"
Dim domainAccount : domainAccount = "User1"
Dim objLocalGroup
Dim objDomainUser
Set objLocalGroup = GetObject("WinNT://" & localComputer & "/" & localGroup & ",group")
Set objDomainUser = GetObject("WinNT:").OpenDSObject("WinNT://" & domain & "/" & domainController & "/" & domainAccount, domainAccount, "Password1234", ADS_SECURE_AUTHENTICATION or ADS_SERVER_BIND)
'Add domain user to local group.
objLocalGroup.Add(objDomainUser.ADsPath)
If Err.Number <> 0 Then
WScript.Echo Err.Number
WScript.Echo Err.Description
Else
WScript.Echo domainAccount & " has been added to local group " & localGroup
End If
谢谢
答案 0 :(得分:0)
SYSTEM帐户没有连接到其他主机的业务。以具有本地管理员权限的用户身份运行脚本。