Ghost21 Posted December 11, 2007 Share Posted December 11, 2007 Having trouble when I try to pull an IP address from a computer on the network and it can't get it the program just crashes with this error... $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) $colItems = $objWMIService^ ERROR I'm really bad at error checking can someone give me an example that works to learn from... My error checking right now consists of If @error then Continueloop which ain't working to S*** hot for me... HELP!!! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 11, 2007 Developers Share Posted December 11, 2007 Add an COM errorhandler as described in the Helpfile to avoid the script from stopping to run.. 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 More sharing options...
PsaltyDS Posted December 11, 2007 Share Posted December 11, 2007 (edited) Having trouble when I try to pull an IP address from a computer on the network and it can't get it the program just crashes with this error... $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) $colItems = $objWMIService^ ERROR I'm really bad at error checking can someone give me an example that works to learn from... My error checking right now consists of If @error then Continueloop which ain't working to S*** hot for me... HELP!!! Probably means your $objWMIService = ObjGet(...etc.) failed. Test it with: If Not IsObj($objWMIService) Then MsgBox(16, "Error", "Failed to get WMI object") Exit EndIf P.S. ...or you could just add a COM error handler like Jos said -- If you want to go with the boring, correct way... Edited December 11, 2007 by PsaltyDS 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...
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