Rediger

Del via


IVMVirtualMachine::RemoveConfigurationValue method

[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]

Removes the value of the specified configuration setting for this virtual machine.

Syntax

HRESULT RemoveConfigurationValue(
  [in] BSTR configurationKey
);

Parameters

configurationKey [in]

The key used to identify the configuration value as stored in the "*.vmc" file.

Return value

This method can return one of these values.

Return code/value Description
S_OK
0
The operation was successful.
E_INVALIDARG
0x80000003
The parameter is NULL or empty.
VM_E_VM_UNKNOWN
0xA0040207
The configuration is unknown.
VM_E_PREF_NOT_FOUND
0xA0040300
The preference was not found.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.

Remarks

This method provides low-level access to any configuration value. It can be used to remove configuration values for customer-defined keys. Be careful if you use this method to remove system configuration values, since some values cannot be changed while the virtual machine is running.

Configuration keys are located in the virtual machine's "*.vmc" file in XML format. The keys are stored in a hierarchical manner similar to the registry keys in Windows. To specify a specific subkey, a "key path" is constructed which specifies the various keys in a slash mark delimited format.

For example, to remove the value of the "ram_size" key located in the following key tree:

<hardware>
    <memory>
        <ram_size type="integer">128</ram_size>

The configurationKey path string would be specified as follows:

"hardware/memory/ram_size"

If any of the keys in the desired tree have an "id" attribute value, the attribute and its value is embedded in the configurationKey path string immediately after its associated configuration key using the following bracketed format: "[@id="id_value"]".

For example, to remove the value of the "absolute" key located in the following key tree:

<hardware>
    <pci_bus>
        <ide_adapter>
            <ide_controller id="1">
                <location id="0">
                    <pathname>
                        <absolute type="string">D</absolute>

The configurationKey path string would be specified as follows:

"hardware/pci_bus/ide_adapter/ide_controller[@id=1]/location[@id=0]/pathname/absolute"

Requirements

Requirement Value
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
End of client support
Windows 7
Product
Windows Virtual PC
Header
VPCCOMInterfaces.h
IID
IID_IVMVirtualMachine is defined as f7092aa1-33ed-4f78-a59f-c00adfc2edd7

See also

IVMVirtualMachine