Search code examples
objectbatch-filereferenceparameter-passingwmic

How do I call a WMI method with an object reference parameter from WMIC?


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?


Solution

  • 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