Jump to content

Obj error impossible to fix


ricky
 Share

Recommended Posts

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 by ricky03
Link to comment
Share on other sites

  • Moderators

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!

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

This is a part of my script used:

Local $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."

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.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 (NEW 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

 

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...