Jump to content
Sign in to follow this  
mattw112

WMI Help

Recommended Posts

mattw112

I used the WMIExplorer (found on this site) to get some details on WMI.

I want to be able to execute a certain method.

Here's the example I got from the WMIExplorer:

#cs

$Computer = "."

$Class = "WakeUp"

$Method = "WakeColl"

$MC = [WmiClass]"\\$Computer\ROOT\N1E\WakeUp:$Class"

$InParams = $mc.psbase.GetMethodParameters($Method)

$InParams.sInArg = [string]

"Calling WakeUp. : WakeColl with Parameters :"

$inparams.PSBase.properties | select name,Value | format-Table

$R = $mc.PSBase.InvokeMethod($Method, $inParams, $Null)

"Result :"

$R | Format-list

#ce

Not sure how to translate that into something I can use in AutoIt? Below is my try, but it is not working.

$SMSID="C0100046"
$objWMIService = ObjGet("winmgmts:\\.\root\N1E\WakeUp:WakeUp")
$objinParams = $objWMIService.psbase.GetMethodParameters("WakeColl")
$objinParams.sInArg = [string]
$objinParams.PSBase.properties
$objOutParams = $objWMIService.ExecMethod("WakeUp", $objinParams, $SMSID)
$ReturnValue = $objOutParams.ReturnValue
MsgBox(0, "TEST", $ReturnValue)

Any ideas?

Thanks,

Terry

Edited by mattw112

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  

×