0

我正在尝试将域用户帐户添加到本地组,如果我登录到计算机,一切正常,但如果我在 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

谢谢

4

1 回答 1

0

SYSTEM 帐户没有业务连接到其他主机。以具有本地管理员权限的用户身份运行脚本。

于 2013-02-21T19:39:59.117 回答