supersonic Posted April 21, 2009 Share Posted April 21, 2009 Hi! I'm "messing" around with the UDF "adfunctions.au3". When running a script using this UDF on a non-AD computer, I get the following error message (- even when no AD functions are called): C:\TEMP\_\AUTOIT\Include\ADFunctions\ADFunctions.au3 (104) : ==> Variable must be of type "Object".: Global $strDNSDomain = $objRootDSE.Get("defaultNamingContext") Global $strDNSDomain = $objRootDSE^ ERROR How could I avoid the error and keep the script running? Setting an error handler couldn't this (yet). Any Ideas? Greets, -supersonic. Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 21, 2009 Share Posted April 21, 2009 Hi!I'm "messing" around with the UDF "adfunctions.au3".When running a script using this UDF on a non-AD computer,I get the following error message (- even when no AD functions are called):C:\TEMP\_\AUTOIT\Include\ADFunctions\ADFunctions.au3 (104) : ==> Variable must be of type "Object".:Global $strDNSDomain = $objRootDSE.Get("defaultNamingContext")Global $strDNSDomain = $objRootDSE^ ERRORHow could I avoid the error and keep the script running?Setting an error handler couldn't this (yet).Any Ideas?Greets,-supersonic.That UDF unconditionally initializes some domain related global variables by running some COM functions at run time without any of its UDF functions being called yet. I don't care for that and believe that makes it a poorly behaved UDF, but maybe that's just me.You need a COM error handler to handle these errors gracefully. Another option is to put that portion of the initialization in a function of its own, like _AD_Init(), and only run that to initialize those globals when you expect to be on a domain. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
supersonic Posted April 22, 2009 Author Share Posted April 22, 2009 (edited) Thank you for the answer.I added:If IsObj($oRootDSE) = 0 Then Return ""... this helped me out.That UDF unconditionally initializes some domain related global variables by running some COM functions at run time without any of its UDF functions being called yet. I don't care for that and believe that makes it a poorly behaved UDF, but maybe that's just me.You need a COM error handler to handle these errors gracefully. Another option is to put that portion of the initialization in a function of its own, like _AD_Init(), and only run that to initialize those globals when you expect to be on a domain. Edited April 22, 2009 by supersonic Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now