Share via


IVMVirtualServer::RegisterVirtualMachine method

The RegisterVirtualMachine method registers an existing virtual machine configuration and returns the virtual machine object.

Syntax

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

Parameters

configurationName [in]

The name of the virtual machine to register. The length of the name cannot exceed 256 characters and the combined length of the name and path cannot exceed 260 characters. The specified name may contain the .vmc file extension. 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 contains the existing configuration file. If the configurationName parameter is NULL or an empty string, this must specify the full path to the existing 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 configurationName and configurationPath parameters.
E_FILE_NOT_FOUND
The system cannot find the file specified by the configurationName and configurationPath parameters.
E_INVALID_NAME
configurationPath contains an invalid character (one of "*?:<>/|"").
E_BAD_PATHNAME
The parameter 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 in a path that is too long. The combined 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 has 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