Jul 07 2017

Add Multiple ESXi Hosts To vCenter Server Using PowerCLi

A few days back I created a vSphere cluster with 32 ESXi hosts and I really didn’t want to add all these hosts using the UI so I decided to put together a short powercli script to manage this.

The script that was tested using the following software versions:

  • VMware vCenter Server 6.5
  • VMware ESXi 6.5 build 5146846
  • VMware PowerCLI 6.5 Release 1 build 4624819


Below is the script output when running in my lab environment.

If you want to limit the script output you can add “| out-null” to the add-vmhost section so the new line would be:

  • Add-VMHost $esxihost -Location $vcenterlocation -User $esxihostuser -Password $esxihostpasswd” | out-null

The new output will then be according to the below output:

Happy PowerCLI scripting

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">