Jump to content

Help to use WMI .put_ and .delete_() method


Fasix
 Share

Recommended Posts

hello, i need to learn to menage WMI with autoit, but it's hard.

following examples of other udf, here in this forum, to menage printers by WMI i try this:

Func _Modyfing()
    Local $colItems, $objWMIService, $objItem

    $strComputer = "."
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.Get("ActiveScriptEventConsumer").SpawnInstance_

    If IsObj($colItems) Then
        ;$colItems.CreatorSID
        ;$colItems.KillTimeout
        ;$colItems.MachineName
        ;$colItems.MaximumQueueSize
        $colItems.Name = "NewName"
        ;$colItems.ScriptFilename
        ;$colItems.ScriptingEngine
        ;$colItems.ScriptText
        $colItems.Put_
        MsgBox(0,'','Done')
    Else
        SetError(1, 2, 0)
    EndIf
EndFunc

with this result in console:

"C:\Users\fasix\Desktop\WmiTools.au3" (289) : ==> The requested action with this object has failed.:
$colItems.Put_
$colItems^ ERROR

and same thing appens with the .Delete_() method!

after 3 days of reading and reading and trying.... i'm in your hands

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