Reputation: 978
How do I call a WMI method (e.g. RemoveVirtualSystemSnapshot()
where the first parameter is a reference to the CIM_VirtualSystemSettingData
) with an object reference parameter from WMIC?
I haven't found how to refer to an object. I can find the object with WMIC, but I don't know how to get from wmic path ... where ...
that returns some text output to a WMIC command that calls RemoveVirtualSystemSnapshot()
with that object as the first parameter.
I'm sure I can do this many other ways (C#, VBScript, ...), but I'm wondering if it is possible with WMIC?
Upvotes: 2
Views: 2042
Reputation: 3010
According to this article, you can get a string value referencing an object with the following command:
wmic PATH <ClassName> GET __RELPATH /FORMAT:LIST
and then pass it to the parameter/property accepting that type of object.
Upvotes: 0
Reputation: 2222
This is in fact not possible according to the documentation from Microsoft. Microsoft states the following information:
Problem: Input parameter is of OBJECT type
Cause: Support is not fully implemented yet for input parameters which are of the OBJECT type. The default value (an empty string: "") is the only value currently supported.
Solution: Use the following command to set sharing of the c:\test directory for three users: WMIC SHARE CALL Create "","test","3","TestShareName","","c:\test",0
You can find this information on their "Troubleshooting WMIC" page: http://technet.microsoft.com/en-us/library/cc738752(v=ws.10).aspx#BKMK_8
Upvotes: 1
Reputation: 57252
I don't think it's possible.However here's how WMIC
represents the objects:
\\HostName\ROOT\cimv2:ClassName.Key1="Key1Value",Key2="Key2Value",..
(can be seen ASSOC verb ) but I don't it's possible to be used with WMIC -I've tried a lot of things - but still the object representations are taken as strings.Another thing is MOFCOMP where you can compile .mof file and create an object with alias , but it still can be passed to a method.My last hope is to use some of the odbc/sql command line tools that come packed with the Windows and use more complex WQL queries , but probably it's pointless...
Upvotes: 1