Version: 9
restore

Contents

Method

RunWmiInstanceMethod

ModuleNativeServices
LibraryCore
Action

Run a WMI object method.

Parameters

Namespace (string; optional, default "root\cimv2"): The WMI namespace to use, e.g. "root\ccm".

Query (string): WMI query to select the object(s) to run the method on.
Method (string): The name of the WMI method to run.

AsUser (string; optional; default 1E.Client service user) Windows only: The "domain\user" (down-level logon) account name that the Agent will attempt to impersonate on the local machine.

If this parameter is absent the command will be executed in the Tachyon Agent process's user context.

It is not an error if the specified user is not currently logged on (and this includes accounts that are not even defined). In this case execution is deemed successful but the method does nothing and returns no data.

The specified user must be currently logged on and running explorer.exe (Windows Explorer).

Available from v5.3.

AllInstances (boolean): Whether to run the method on all object instances (if there is more than one) or just the first.
Additional parameters for the specific method call. Their names are prefixed with "Param_".
Return values

The accumulated output, if any, from the method invocation(s).

Example
NativeServices.RunWmiInstanceMethod(Namespace:"root\\cimv2", Query:"SELECT * FROM Win32_Process WHERE Name = 'notepad.exe'", AllInstances:true, Method:"Terminate", Param_Reason:"1");
Platforms
  • Windows
Notes

Unlike the recommendation described for the RunWmiQuery method, "SELECT *" must usually be specified in the query otherwise the WMI objects produced by the filter will be incomplete and the WMI method will fail if it requires objects to work on.