IVMVirtualPC::CreateVirtualMachine method
[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]
Creates a new virtual machine configuration and retrieves the virtual machine object.
Syntax
HRESULT CreateVirtualMachine(
[in] BSTR configurationName,
[in] BSTR configurationPath,
[out, retval] IVMVirtualMachine **virtualMachine
);
Parameters
-
configurationName [in]
-
The name of the virtual machine to be created. The length of the name cannot exceed 80 characters and the combined length of the name and path to VMC and VMCX files cannot exceed MAX_PATH (260) characters. The file name extensions .vmc and .vmcx will be appended to the end of the virtual machine name when the configuration files are created. If this parameter is NULL or an empty string, the configurationPath parameter must specify the full path to the VMC file.
-
configurationPath [in]
-
The path to the folder that will contain the VMC file. This folder will be created if it does not exist. If configurationName is NULL or an empty string, this must specify the full path of the new configuration file.
-
virtualMachine [out, retval]
-
A pointer to a new IVMVirtualMachine object that represents this virtual machine.
Return value
This method can return one of these values.
Return code/value | Description |
---|---|
|
The operation was successful. |
|
The configurationName or configurationPath parameter is not valid, or the virtualMachine parameter is NULL. |
|
The system cannot find the path specified by the configurationPath parameter. |
|
The configurationPath parameter contains an invalid character (one of "*?:<>/|""). |
|
The configurationPath parameter specifies an empty or relative path. An absolute path is required. |
|
The path specified by the configurationName and configurationPath parameters results in a path that is too long. The total length of the path must be less than MAX_PATH (260) characters. |
|
A configuration file with this name already exists at this location. |
|
The configurationName parameter is empty. |
|
The configurationName parameter exceeds 80 characters in length. |
|
The configurationName parameter contains an invalid character (one of "*?:<>/|\""). |
|
There is already a virtual machine with this name. |
|
The processor does not support Hardware Accelerated Virtualization (HAV) extensions. |
|
An unexpected error has occurred. |
Remarks
Virtual machine names are case-insensitive, for example, "MyVM" and "myvm" refer to the same virtual machine.
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 |