ricky Posted January 19, 2015 Posted January 19, 2015 (edited) Hello, I have an error with the command below : Local $WMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\Microsoft\SqlServer\ComputerManagement11") The error handler provide me the error : 0x8004100E - Namespace specified cannot be found After this error, the script continues and the objGet return me @error = -2147217394 I don't understand why. For information, on this Recorder, no sql installed. Thanks in advance for your help Edit : executed on win 7 x64 Edited January 19, 2015 by ricky03
Moderators JLogan3o13 Posted January 19, 2015 Moderators Posted January 19, 2015 Why is it "impossible to fix"? Local $WMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\Microsoft\SqlServer\ComputerManagement11") If IsObj($WMI) Then MsgBox(0, "", "Yes") Else MsgBox(0, "", "No") EndIf "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
ricky Posted January 19, 2015 Author Posted January 19, 2015 (edited) It crash before the if! It's very strange. I'm using the version 3.3.12.0 I try also with the line below and the problem is the same. Local $WMI = ObjGet("winmgmts:\\.\root\Microsoft\SqlServer\ComputerManagement11") Edited January 19, 2015 by ricky03
Moderators JLogan3o13 Posted January 19, 2015 Moderators Posted January 19, 2015 What does the SciTE console output show you? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
water Posted January 20, 2015 Posted January 20, 2015 To handle COM errors you need a COM error handler (depending on the version of AutoIt). Please see ObjEvent for examples. Which version of AutoIt do you run? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ricky Posted January 20, 2015 Author Posted January 20, 2015 This is a part of my script used: expandcollapse popupLocal $oErrorHandler = ObjEvent('AutoIt.Error', '_ObjErrorHandler') Local $WMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\Microsoft\SqlServer\ComputerManagement11") If IsObj($WMI) Then MsgBox(0, "", "Yes") Else MsgBox(0, "", "No") EndIf Func _ObjErrorHandler() lOCAL $Object_Error = 0 If Not IsObj($oErrorHandler) Then MsgBox(8240, 'ObjErrorHandler', 'Critical Error - Exiting', 10) Exit EndIf ; ; If $Object_Error Then $oErrorHandler.Clear Return; first error remains until reset. Else $Object_Error = 1 EndIf ; Local $AOE1 = $oErrorHandler.ScriptLine Local $AOE2 = Hex($oErrorHandler.Number, 8) Local $AOE3 = $oErrorHandler.Description Local $AOE4 = $oErrorHandler.WinDescription ; $oErrorHandler.Clear ; ; Local $sMsg = '' If $AOE1 Then $sMsg &= 'Line:' & $AOE1 If $AOE2 Then $sMsg &= ' (0x' & $AOE2 & ') ' If $AOE3 Then $sMsg &= $AOE3 & ' ' If $AOE4 Then $sMsg &= $AOE4 ; If $sMsg Then $ObjError_Msg = 'Object Error - ' & $sMsg EndIf ; MsgBox(8240, 'Object Error', $ObjError_Msg) Return SetError(-1) EndFunc ;==>_ObjErrorHandler I use the version 3.3.12.0 and the error is "Object Error - Line:3 (0x8004100E) Namespace specified cannot be found."
water Posted January 20, 2015 Posted January 20, 2015 I suggest to have a look at Scriptomatic in the Example Scripts section. Scriptomatic generates AutoIt WMI code for you. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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