Compartir a través de


IVMVirtualServer::CreateVirtualMachine method

The CreateVirtualMachine method creates a new virtual machine configuration and returns the virtual machine object.

Syntax

HRESULT CreateVirtualMachine(
  [in]  BSTR              configurationName,
  [in]  BSTR              configurationPath,
  [out] IVMVirtualMachine **virtualMachine
);

Parameters

configurationName [in]

The name of the virtual machine to create. The length of the name cannot exceed 256 characters and the combined length of the name and path cannot exceed 260 characters. The file name extension ".vmc" will be appended to the end of the virtual machine name when the configuration file is created. If this parameter is NULL or an empty string, the configurationPath parameter must specify the full path to the configuration file.

configurationPath [in]

The path to the folder that will contain the configuration 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]

A pointer to a new IVMVirtualMachine object which represents this virtual machine.

Return value

This method supports standard return values, as well as the following. For information on Virtual Server specific return values not listed below, see HRESULT Codes Specific to the Virtual Server.

Return code Description
S_OK
The operation was successful.
E_POINTER
configurationName or configurationPath is invalid, or virtualMachine is NULL.
E_PATH_NOT_FOUND
The system cannot find the path specified by the configurationPath parameter.
E_INVALID_NAME
configurationPath contains an invalid character (one of "*?:<>/|"").
E_BAD_PATHNAME
The configurationPath parameter specifies an empty or relative path. An absolute path is required.
E_BUFFER_OVERFLOW
The path specified by the configurationName and configurationPath parameters results is a path that is too long. The total length of the path must be less than 260 characters.
E_ALREADY_EXISTS
A configuration file with this name already exists at this location.
VM_E_CONFIG_NAME_INVALID_CHAR
configurationName contains an invalid character (one of "*?:<>/|\"").
VM_E_CONFIG_DUPLICATE_NAME
There is already a virtual machine with this name.
DISP_E_EXCEPTION
An unexpected error occurred.

Remarks

Virtual machine names are case-insensitive, for example, "MyVM" and "myvm" refer to the same virtual machine.

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMVirtualServer