WMI-Problem

  • Hallo zusammen,

    ich nutze eine UDF zum Thema Services.
    Leider kommt es dabei zu Problemen, so heißt es z.B.
    ... : ==> Error in expression.:
    Local $sItems = $Service.ExecQuery ($sQuery)
    Local $sItems = ^ ERROR

    komplette Funktion
    [autoit]


    ;===============================================================================
    ; Name: _Service_Exists()
    ; Function: _Service_Exists()
    ; Description: Checks to see if a service is installed
    ; Syntax: _Service_Exists($sServiceName)
    ; Parameter(s): $sServiceName - Name of service to check
    ; Requirement(s): WMI capable operating system and administrator rights on the computer
    ; Return Value(s): Success - Returns 1
    ; Failure - Returns 0
    ; Author(s): engine
    ; Modification(s): Total rewite of this function by engine June 10, 2008
    ;===============================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Func _Service_Exists($sServiceName, $Computer = "localhost")
    _sServErrorHandlerRegister()
    Local $Service = ObjGet("winmgmts:\\" & $Computer & "\root\cimv2")
    Local $sQuery = "Select * from Win32_Service where name like '"& $sServiceName &"'"
    Local $sItems = $Service.ExecQuery ($sQuery)
    _sServErrorHandlerDeRegister()
    For $objService In $sItems
    Return True
    Next
    Return False
    EndFunc ;<==> _Service_Exists()

    [/autoit]

    Der PC scheint Probleme mit WMI zu haben und es tauchen auch DCOM-Fehler im Eventlog auf.

    Was kann ich am besten machen?

    LG FKF