vSphere PowerCLI Reference



Adds a host to be managed by a vSphere server.


Add-VMHost [-Name] <String> [-Port <Int32>] [-Location] <VIContainer> [-Credential <PSCredential>] [-User <String>] [-Password <String>] [-Force] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version

Detailed Description

Adds a host to be managed by a vSphere server. The host is added to the datacenter or folder specified by the Location parameter. One of the User/Password and Credential parameters must be provided in order to authenticate with the host. If both are specified, the Credential parameter is used and the User and Password parameters are ignored.


NameTypeDescriptionRequired?Pipeline InputDefault Value
NameStringSpecify the name of the host you want to add to a vSphere server.truefalse
LocationVIContainerSpecify a datacenter or folder where you want to place the host.truetrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse$true
CredentialPSCredentialSpecify a PSCredential object that contains credentials for authenticating with the virtual machine host.falsefalse
ForceSwitchParameterIndicates that the cmdlet runs even if the authenticity of the host SSL certificate cannot be verified.falsefalse
PasswordStringSpecifies the password you want to use for authenticating with the host.falsefalse
PortInt32Specify the port on the host you want to use for the connection.falsefalseFor ESX 2.x hosts this is the authd port (902 by default). For ESX 3.x and above this is the https port (443 by default).
RunAsyncSwitchParameterIndicate that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the -RunAsync parameter run " help About_RunAsync" in the vSphere PowerCLI console.falsefalse
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
UserStringSpecify the user name you want to use for authenticating with the host.falsefalse
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type



Add-VMHost works only if there is a connection to vCenter Server.


-------------- Example 1 --------------

Add-VMHost -Location Datacenter -User root -Password pass

Adds an ESX host with IP address to the Datacenter datacenter.

Copyright © 1998 - 2011 VMware, Inc. All rights reserved.