调用 GetObject(“WinNT://JohnDoe,User”) 时出现 VBScript 错误

发布于 2024-08-20 11:37:17 字数 492 浏览 4 评论 0原文

我有一年多没有碰过的代码,但 DC 从 2008 升级到 2008 R2。 AD 人员声称这不是 DC 升级,但问题在升级后立即开始。

Microsoft VBScript 运行时错误“800a0046”
权限被拒绝:“GetObject”

在“设置组”行上失败。

Set Group = GetObject("WinNT://" & Logon_name & ",User")

For each Member in Group.Groups
  If Member.Class = "Group" then
    If Member.Name = "TEST_AD_GROUP" Or Member.Name = "TEST_AD_GROUP2" then
      x = "true"
      Exit For
    End If
  End If
Next

谢谢。

I have code that hasn't been touched in over a year, but the DCs were upgraded from 2008 to 2008 R2. The AD folks claim it’s not the DC upgrade but the issue started promptly after that went in.

Microsoft VBScript runtime error '800a0046'
Permission denied: 'GetObject'

It's failing on the Set Group line.

Set Group = GetObject("WinNT://" & Logon_name & ",User")

For each Member in Group.Groups
  If Member.Class = "Group" then
    If Member.Name = "TEST_AD_GROUP" Or Member.Name = "TEST_AD_GROUP2" then
      x = "true"
      Exit For
    End If
  End If
Next

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

献世佛 2024-08-27 11:37:17

我必须更改代码以传递用户 ID 和密码。

Set objIADS = GetObject("WinNT:").OpenDSObject("WinNT://" & strDomain, strUsername, strPassword, ADS_SECURE_AUTHENTICATION)
Set objIADSUser = objIADS.GetObject("user", strUsername)

For each Member in objIADSUser.Groups
    If Member.Class = "Group" then
        If Member.Name = "TEST_AD_GROUP" then
            x = "true"
            EXIT FOR
        End If
    End If
Next

i had to change the code to pass in the userid and pwd.

Set objIADS = GetObject("WinNT:").OpenDSObject("WinNT://" & strDomain, strUsername, strPassword, ADS_SECURE_AUTHENTICATION)
Set objIADSUser = objIADS.GetObject("user", strUsername)

For each Member in objIADSUser.Groups
    If Member.Class = "Group" then
        If Member.Name = "TEST_AD_GROUP" then
            x = "true"
            EXIT FOR
        End If
    End If
Next
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文