Jump to content

Error: Variable must be of type "Object"


Recommended Posts

Does anyone know what this means, or what I need to look for to solve this error? If code is needed I will post it. (but the uncompiled script works on all both 2003 and XP).

The entire error message:

Line 0 (File "C:\Documents and Settings\Desktop\SP_AUTOMATED.exe"):

Global $strDNSDomain = $objRootDSE.Get ("defaultNamingContext")

Global $strDNSDomain = $objRootDSE^ ERROR

Error: Variable must be of type "Object".

Thanks a bunch.

Pas

Link to comment
Share on other sites

Does anyone know what this means, or what I need to look for to solve this error? If code is needed I will post it. (but the uncompiled script works on all both 2003 and XP).

The entire error message:

Line 0 (File "C:\Documents and Settings\Desktop\SP_AUTOMATED.exe"):

Global $strDNSDomain = $objRootDSE.Get ("defaultNamingContext")

Global $strDNSDomain = $objRootDSE^ ERROR

Error: Variable must be of type "Object".

Thanks a bunch.

Pas

This means that $objRootDSE is not an object, thus whatever sets the value of $objRootDSE has failed.

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

This means that $objRootDSE is not an object, thus whatever sets the value of $objRootDSE has failed.

Ok, I understand the error message.

What I don't understand is what or where the variable $objRootDSE is. I certainly do not use a variable in my program by that name and it only throws the error after the script is compiled in an .exe and only on XP for that matter.

In Windows 2003 server is works fine. I tried compiling it in several different ways but no luck.

Any other ideas?

Link to comment
Share on other sites

  • Developers

Ok, I understand the error message.

What I don't understand is what or where the variable $objRootDSE is. I certainly do not use a variable in my program by that name and it only throws the error after the script is compiled in an .exe and only on XP for that matter.

In Windows 2003 server is works fine. I tried compiling it in several different ways but no luck.

Any other ideas?

Pretty sure you set that variable somewhere in your script ..

something like:

$objRootDSE = ObjGet("LDAP://RootDSE")

Just test after this statement if the $objRootDSE is an object.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Pretty sure you set that variable somewhere in your script ..

something like:

$objRootDSE = ObjGet("LDAP://RootDSE")

Just test after this statement if the $objRootDSE is an object.

I apologize for my rudeness and ignorance guys. I forgot I used some UDF's in this script and it has exactly that line of code in it JdeB described. (I'm feeling like an :) )

I am fairly new to autoit and I could probably find out myself but... How do I test to make sure it's an object?

Thanks a bunch

Edited by GreenHouse
Link to comment
Share on other sites

Ok, so I identified the cause of the error:

Global $objRootDSE = ObjGet("LDAP://RootDSE")
Global $strDNSDomain = $objRootDSE.Get ("defaultNamingContext")  ; Retrieve the current AD domain name
Global $strHostServer = $objRootDSE.Get ("dnsHostName") ; Retrieve the name of the connected DC
Global $strConfiguration = $objRootDSE.Get ("ConfigurationNamingContext") ; Retrieve the Configuration naming context

This is a portion of a included script.

So when I try to run it on a Domain controller it works because it is using AD. In XP it bombs out because it doesn't use AD.

No how can I get it to test for this? I tried putting these variables between an If Then statement but it then gives me other errors.

Any help would be appreciated.

Thanks,

-Pas

Edited by GreenHouse
Link to comment
Share on other sites

  • Developers

Ok, so I identified the cause of the error:

Global $objRootDSE = ObjGet("LDAP://RootDSE")
Global $strDNSDomain = $objRootDSE.Get ("defaultNamingContext")  ; Retrieve the current AD domain name
Global $strHostServer = $objRootDSE.Get ("dnsHostName") ; Retrieve the name of the connected DC
Global $strConfiguration = $objRootDSE.Get ("ConfigurationNamingContext") ; Retrieve the Configuration naming context

This is a portion of a included script.

So when I try to run it on a Domain controller it works because it is using AD. In XP it bombs out because it doesn't use AD.

No how can I get it to test for this? I tried putting these variables between an If Then statement but it then gives me other errors.

Any help would be appreciated.

Thanks,

-Pas

:) how would this work on an WinXP machine thats not in the AD and the Logged on user not being an AD Administrator ?

Could be some AD functions work for regular users but i think at least you need to be logged in to the DA..

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

:) how would this work on an WinXP machine thats not in the AD and the Logged on user not being an AD Administrator ?

Could be some AD functions work for regular users but i think at least you need to be logged in to the DA..

Actually I don't want my script to even use the AD UDF if I am on a winXP machine. So do I need to compile a seperate script that gets called if the OSversion is window 2000 server or 2003?

Thanks,

- Pas

Link to comment
Share on other sites

  • Developers

Actually I don't want my script to even use the AD UDF if I am on a winXP machine. So do I need to compile a seperate script that gets called if the OSversion is window 2000 server or 2003?

Thanks,

- Pas

Have you looked at @OSBuild ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...