If you are going to add multiple hosts to vCenter and license them, it will take a while if you do it manually. Instead you can PowerCLI script it.
Open vSphere PowerCLI console and connect to the vCenter.
Connect-VIServer -Server $vCenterServerName
Next run the following commands for each host which add them to vCenter and then license them.
Add-VMHost $hostname -location $cluster -user root -password $root_password -force:$true Set-VMHost -VMHost $hostname -LicenseKey $license_key
To repeat this for multiple hosts, I use cat and awk to generate the command for each host. I am sure there are better ways to do this using. For instance, use PowerShell and iterate through the list in a loop. But I am a Linux guy, I find it easy enough to do it this way.
Once I have the series of commands, I paste them into PowerCLI console.
$ cat listofhosts | awk '{print "add-vmhost "$1 " -location CLUSTER_NAME -user root -password PASSWORD -force:$true"}' add-vmhost esxi01.example.com -location CLUSTER_NAME -user root -password PASSWORD -force:$true add-vmhost esxi02.example.com -location CLUSTER_NAME -user root -password PASSWORD -force:$true add-vmhost esxi03.example.com -location CLUSTER_NAME -user root -password PASSWORD -force:$true add-vmhost esxi04.example.com -location CLUSTER_NAME -user root -password PASSWORD -force:$true add-vmhost esxi05.example.com -location CLUSTER_NAME -user root -password PASSWORD -force:$true add-vmhost esxi06.example.com -location CLUSTER_NAME -user root -password PASSWORD -force:$true
$ cat listofhosts | awk '{print "Set-VMHost -VMHost "$1 " -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"}' Set-VMHost -VMHost esxi01.example.com -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX Set-VMHost -VMHost esxi02.example.com -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX Set-VMHost -VMHost esxi03.example.com -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX Set-VMHost -VMHost esxi04.example.com -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX Set-VMHost -VMHost esxi05.example.com -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX Set-VMHost -VMHost esxi06.example.com -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Advertisements