D
Dave Burt
Hi,
x1 recently asked about an issue with a WMI script that had an output parameter.
I guess you can get a result from an output parameter via WIN32OLE#_invoke (with
VT_BYREF?) if you have the Dispatch ID for the method. But for a few WMI objects
I've seen recently, I haven't been able to get a WIN32OLE_METHOD instance for a
lot of methods, even ones that I can invoke. For example:
# Get a Win32_Process WMI object
wmi_svc = WIN32OLE.connect("winmgmts:\\\\.\\root\\cimv2:Win32_Process")
# Try to get the method
wmi_svc.ole_method("Create") #=> WIN32OLERuntimeError: Not found Create
# Invoke the method
wmi_svc.invoke("Create", "notepad", nil, nil, nil) #=> (Creates notepad.exe
process)
That last parameter is an output parameter which should return the PID of the
created process as a uint32.
Is there a way I can get info on a method like that, and how do I get the result
of an output parameter?
Cheers,
Dave
x1 recently asked about an issue with a WMI script that had an output parameter.
I guess you can get a result from an output parameter via WIN32OLE#_invoke (with
VT_BYREF?) if you have the Dispatch ID for the method. But for a few WMI objects
I've seen recently, I haven't been able to get a WIN32OLE_METHOD instance for a
lot of methods, even ones that I can invoke. For example:
# Get a Win32_Process WMI object
wmi_svc = WIN32OLE.connect("winmgmts:\\\\.\\root\\cimv2:Win32_Process")
# Try to get the method
wmi_svc.ole_method("Create") #=> WIN32OLERuntimeError: Not found Create
# Invoke the method
wmi_svc.invoke("Create", "notepad", nil, nil, nil) #=> (Creates notepad.exe
process)
That last parameter is an output parameter which should return the PID of the
created process as a uint32.
Is there a way I can get info on a method like that, and how do I get the result
of an output parameter?
Cheers,
Dave