Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBScript Error when calling GetObject("WinNT://JohnDoe,User")

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.

like image 963
ryan Avatar asked Feb 08 '10 15:02

ryan


1 Answers

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
like image 91
ryan Avatar answered Oct 12 '22 18:10

ryan