IVMVirtualServer::CreateVirtualNetwork method
The CreateVirtualNetwork method creates a new virtual network.
Syntax
HRESULT CreateVirtualNetwork(
[in] BSTR virtualNetworkName,
[in] BSTR virtualNetworkPath,
[out] IVMVirtualNetwork **virtualNetwork
);
Parameters
-
virtualNetworkName [in]
-
The name of the new virtual network. 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 ".vnc" will be appended to the end of the virtual network name when the configuration file is created. 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 will contain the configuration file. This folder will be created if it does not exist. If the virtualNetworkName parameter is NULL or an empty string, this must specify the full path the new 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 |
---|---|
|
The operation was successful. |
|
The virtualNetwork parameter is NULL. |
|
The virtualNetworkName or virtualNetworkPath parameter is not valid or is an empty string. |
|
The system cannot find the path specified by the virtualNetworkName and virtualNetworkPath parameters. |
|
The virtualNetworkPath parameter contains a character that is not valid (one of "*?:<>/|""). |
|
The virtualNetworkPath parameter specifies an empty or relative path. An absolute path is required. |
|
The path specified by the virtualNetworkName and virtualNetworkPath parameters results is a path that is too long. The total length of the path must be less than 260 characters. |
|
A configuration file with this name already exists at this location. |
|
The virtualNetworkName parameter contains a character that is not valid (one of "*?:<>/|\""). |
|
There is already a virtual network with this name. |
|
An unexpected error occurred. |
Remarks
By default, the adapter of the virtual network is set for guest-only networking, which isolates the virtual machine from the network. Use the IVMVirtualNetwork::HostAdapter method to change the adapter for this virtual network. 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 |
|