IVMVirtualPC::SetConfigurationValue method
[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]
Sets the value of the specified configuration setting.
Syntax
HRESULT SetConfigurationValue(
[in] BSTR preferenceKey,
[in] VARIANT preferenceValue
);
Parameters
-
preferenceKey [in]
-
The key used to identify the preference, as stored in the per-user configuration file (Options.xml in "%LocalAppData%\Microsoft\Windows Virtual PC").
Important
Changes should be made to Options.xml only using the SetConfigurationValue method. Changing Options.xml using any other method is not supported.
-
preferenceValue [in]
-
The preference value. This value may be one of the following VARIANT types: VT_ARRAY|VT_UI1 (raw bytes), VT_BSTR (string), VT_UI4 (integer), or VT_BOOL (Boolean).
Return value
This method can return one of these values.
Return code/value | Description |
---|---|
|
The operation was successful. |
|
The preferenceKey or preferenceValue parameter is NULL. |
|
The preferenceKey parameter is not valid or is an empty string. |
|
An unexpected error has occurred. |
|
The current user has insufficient access to the configuration file. |
|
The processor does not support Hardware Accelerated Virtualization (HAV) extensions. |
Remarks
The following values are supported for the preferenceKey parameter.
preferenceKey value | Description | Data type | Default value |
---|---|---|---|
"idle_timeout" |
Number of seconds that vpc.exe should wait before exiting if there are no active VMs or applications using the Windows Virtual PC Interfaces. |
"integer" |
"30" |
This method provides low-level access to any configuration value. It can be used to set configuration values for customer-defined keys. Be careful if you use this method to set system configuration values, because no error checking is performed on the configuration value. Also, some configuration values cannot be changed while a virtual machine is running.
Configuration keys are located in the virtual machine's "Options.xml" 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 set the value of the "idle_timeout" key located in the following key tree:
<preferences>
<idle_timeout type="integer">60</idle_timeout>
The preferenceKey path string would be specified as follows:
"idle_timeout"
If any of the keys in the desired tree have an "id" attribute value, the attribute and its value is embedded in the preferenceKey path string immediately after its associated configuration key using the following bracketed format: "[@id="id_value"]".
For example, to set the value of the "golf" key located in the following key tree:
<preferences>
<alpha>
<bravo>
<charlie>
<delta id="1">
<echo id="0">
<foxtrot>
<golf type="string">D</golf>
The preferenceKey path string would be specified as follows:
"alpha/bravo/charlie/delta[@id=1]/echo[@id=0]/foxtrot/golf"
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 |
|
IID |
IID_IVMVirtualPC is defined as 236ba0d9-a24a-4292-a132-27c1421dfd01 |