-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PowerCLI Cookbook
By :

Joining an ESXi host to vCenter is done from vCenter. The cmdlets for adding a host to a vCenter installation all require communication with vCenter. In this section, we'll connect to vCenter and add the host into inventory. All additional configuration to vCenter from PowerCLI will be covered in the next chapter.
Open a new PowerCLI window. This will ensure that no variables are populated and no open connection to an ESXi is lingering.
In this example, you will connect to a vCenter Server instead of directly connecting to an ESXi host. Our vCenter server has the hostname: vcentersrv.domain.local
.
$vcenter = connect-viserver vcentersrv.domain.local
The same certificate warning might be displayed and you might be prompted to log in if your computer cannot single sign-in to the vCenter instance.
Add-VMHost
to add the host into inventory:Add-VMHost -Server $vcenter -Name esxsrv1.domain.local -Location "Primary"
For the purpose of this section, the value of -Location
is assumed to be a datacenter object already created in vCenter. In the next chapter, you'll see code on how to create this datacenter object.
join
operation.Joining an ESXi to vCenter is a simple cmdlet to configure and complete. It simply links the ESXi into vCenter so that all of the additional configuration and control will be directed from the vCenter host.
At this point, connecting to the ESXi host will display a message in the GUI clients that shows it's being managed by vCenter and that all changes should be made through vCenter. That is mostly the case from PowerCLI too, but there might be additional times when configuration needs to be made directly against a host. One example would be to change multipathing settings for storage.
Change the font size
Change margin width
Change background colour