Partager via


IVMVirtualServer::RegisterVirtualNetwork method

The RegisterVirtualNetwork method registers an existing virtual network configuration and returns the virtual network object.

Syntax

HRESULT RegisterVirtualNetwork(
  [in]  BSTR              virtualNetworkName,
  [in]  BSTR              virtualNetworkPath,
  [out] IVMVirtualNetwork **virtualNetwork
);

Parameters

virtualNetworkName [in]

The name of the virtual network 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 .vnc file extension. If this parameter is NULL or an empty string, the virtualNetworkPath parameter must specify the full path to the configuration file.

virtualNetworkPath [in]

The path to the folder that contains the existing configuration file. If the virtualNetworkName parameter is NULL or an empty string, this must specify the full path to the existing configuration file.

virtualNetwork [out]

A pointer to a new IVMVirtualNetwork object which represents this virtual network.

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
The virtualNetwork parameter is NULL.
E_INVALIDARG
The virtualNetworkName or virtualNetworkPath parameter is not valid or is an empty string.
E_PATH_NOT_FOUND
The system cannot find the path specified by the virtualNetworkName and virtualNetworkPath parameters.
E_FILE_NOT_FOUND
The system cannot find the file specified by the virtualNetworkName and virtualNetworkPath parameters.
E_INVALID_NAME
virtualNetworkPath contains an invalid character (one of "*?:<>/|"").
E_BAD_PATHNAME
The parameter virtualNetworkPath parameter specifies an empty or relative path. An absolute path is required.
E_BUFFER_OVERFLOW
The path specified by the virtualNetworkName and virtualNetworkPath parameters results in a path that is too long. The combined length of the path must be less than 260 characters.
VM_E_CONFIG_NAME_INVALID_CHAR
virtualNetworkName contains an invalid character (one of "*?:<>/|\"").
VM_E_CONFIG_DUPLICATE_NAME
There is already a virtual network with this name.
DISP_E_EXCEPTION
An unexpected error has occurred.

Remarks

The name must be unique with respect to the names of any existing virtual networks. Virtual network names are case-insensitive, for example, "MyNetwork" and "mynetwork" refer to the same virtual network.

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