Rediger

Del via


IVMVirtualMachine::GetActivationValue method

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

Retrieves the value of the specified activation setting for this virtual machine.

Syntax

HRESULT GetActivationValue(
  [in]          BSTR    activationKey,
  [out, retval] VARIANT *activationValue
);

Parameters

activationKey [in]

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

activationValue [out, retval]

The activation value. This value can be one of the following VARIANT types: VT_ARRAY | VT_UI1 (raw bytes), VT_BSTR (string), VT_I4 (integer), or VT_BOOL (Boolean).

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 activationKey parameter is NULL or empty.
E_POINTER
0x80004003
The activationValue parameter is NULL.
VM_E_VM_UNKNOWN
0xA0040207
The configuration is unknown.
VM_E_PREF_NOT_FOUND
0xA0040300
The preference was not found, or this configuration has no valid activation.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.

Remarks

This method provides low-level access to any activation value. It can be used to set activation values for customer-defined keys. When a virtual machine is started, a copy is made of its configuration values, which becomes its set of activation values. Activation values are maintained until the virtual machine is shut down or restarted. Note that Windows Virtual PC may only use the configuration to store values for certain keys, that is, the activation value may never be used.

Activation keys are stored internally 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 read the value of the "default_action" key located in the following key tree:

<settings>
    <undo_drives>
        <default_action type="integer">1</default_action>

The activationKey path string would be specified as follows:

"settings/undo_drives/default_action"

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