Sign in to follow this  
Followers 0
GreenHouse

Error: Variable must be of type "Object"

9 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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 ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0