Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PowerCLI Cookbook

You're reading from   PowerCLI Cookbook Over 75 step-by-step recipes to put PowerCLI into action for efficient administration of your virtual environment

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781784393724
Length 274 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Philip Brandon Sellers Philip Brandon Sellers
Author Profile Icon Philip Brandon Sellers
Philip Brandon Sellers
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Configuring the Basic Settings of an ESXi Host with PowerCLI 2. Configuring vCenter and Computing Clusters FREE CHAPTER 3. Managing Virtual Machines 4. Working with Datastores and Datastore Clusters 5. Creating and Managing Snapshots 6. Managing Resource Pools, Reservations, and Limits for Virtual Machines 7. Creating Custom Reports and Notifications for vSphere 8. Performing ESXCLI and in-guest Commands from PowerCLI 9. Managing DRS and Affinity Groups using PowerCLI 10. Working with vCloud Director from PowerCLI A. Setting up and Configuring vCloud Director Index

Joining an ESXi host to vCenter

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.

Getting ready

Open a new PowerCLI window. This will ensure that no variables are populated and no open connection to an ESXi is lingering.

How to do it…

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.

  1. To connect to vCenter, use the same cmdlet that you used in the Connecting to an ESXi host or a vCenter instance recipe:
    $vcenter = connect-viserver vcentersrv.domain.local 
    

    Note

    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.

  2. Once connected to vCenter, you can use the Add-VMHost to add the host into inventory:
    Add-VMHost -Server $vcenter -Name esxsrv1.domain.local -Location "Primary"
    

    Note

    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.

  3. When prompted, enter the administrative account credentials for the ESXi to perform the join operation.
  4. The host is now added to vCenter Server and can be administered by the server.

How it works…

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.

See also

  • The Creating a virtual datacenter in vCenter, Creating a cluster and adding ESXi hosts, and Setting cluster advanced features, including HA, DRS, and EVC recipes in Chapter 2, Configuring vCenter and Computing Clusters
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image