Jump to content
Sign in to follow this  
ricky

Obj error impossible to fix

Recommended Posts

ricky

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

Share this post


Link to post
Share on other sites
ricky

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 by ricky03

Share this post


Link to post
Share on other sites
JLogan3o13

What does the SciTE console output show you?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
water

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 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
ricky

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

Share this post


Link to post
Share on other sites
water

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 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  

×