Rediger

Del via


IVMVirtualMachine::Name property

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

Retrieves and sets the name of the virtual machine configuration.

This property is read/write.

Syntax

HRESULT put_Name(
  [in]          BSTR virtualMachineName
);

HRESULT get_Name(
  [out, retval] BSTR *virtualMachineName
);

Property value

Specifies the name of the virtual machine configuration. The length of the name cannot be more than 80 characters and the total length of the fully qualified path that includes the virtual machine name configuration file cannot be more than MAX_PATH (260) characters.

Error codes

Name/value Meaning
S_OK
0
The operation was successful.
E_POINTER
0x80004003
The parameter is NULL.
E_INVALIDARG
0x80000003
The parameter is not valid or is an empty string.
VM_E_VM_UNKNOWN
0xA0040207
The configuration is unknown.
VM_E_PREF_VM_ACTIVE
0xA0040302
The virtual machine is running or saved.
VM_E_CONFIG_NO_NAME
0xA0040400
The virtualMachineName parameter is empty.
VM_E_CONFIG_NAME_TOO_LONG
0xA00400401
The parameter contains too many characters.
VM_E_CONFIG_NAME_INVALID_CHAR
0xA0040402
The parameter contains one of the following invalid characters "*?:<>/|\"".
VM_E_CONFIG_DUPLICATE_NAME
0xA0040403
The specified name already exists as the name of another virtual machine.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.

Remarks

Virtual machine names are case-insensitive, e.g. "MyVM" and "myvm" refer to the same virtual machine. This is the default property for IVMVirtualMachine.

If VPC.exe is running and the VM is saved then setting the Name property will not succeed. If VPC.exe is not running and the VM is saved then setting the Name property will succeed when VPC.exe is next started.

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