Sign in to follow this  
Followers 0
Fasix

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

2 posts in this topic

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

Share this post


Link to post
Share on other sites



Fasix,

This UDF by jguinch will tell you all you need to know.

kylomas

1 person likes this

Forum Rules         Procedure for posting code

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  
Followers 0