Created
May 1, 2019 22:48
-
-
Save Robert-LTH/f405cc60ad57bf17b2d2b3795b13afda to your computer and use it in GitHub Desktop.
The order of WMI method parameters is a pain!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MethodClass = [WmiClass]"\\COMPUTERNAME\NAMESPACE:CLASS" | |
$Method = "MethodName" | |
$InParams = $MethodClass.psbase.GetMethodParameters($Method) | |
$InParams.PSBase.properties | select Name,Value | format-Table | |
# Set the parameters with $InParams.Property = "" | |
# and invoke as follows | |
$Result = $MethodClass.InvokeMethod($Method, $InParams, $null) | |
$Result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment