Monday, September 24, 2012

PowerCLI: Add-VMHost deception

After using for two months a dozen of standalone ESXi 5 servers, and having the trial period just expired, I decided to join them to our vCenter infrastructure. Instead of using the manual procedure (right click on a cluster or folder, select 'Add host', enter the connection setting (hostname, user and password), assign a license, enable or disable lockdown mode and choose the location for this host's VM), I wanted to try the PowerCLI way.

So, I fired up a PowerGUI editor, and started checking the syntax for the 'Add-VMHost' cmdlet:


Adds a host to be managed by a vSphere server.

Add-VMHost [-Name]  [-Port ] [-Location]  [-Credential ] [-User ] [-Password ] [-Force] [-RunAsync] [-WhatIf] [-Confirm] []

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.

To my great surprise there is no way of specifying a license to use... and this leads me to a lose-lose situation, because, being my ESXi expired, the cmdlet doesn't let me add these hosts to my vCenter and returns this error:

Add-VMHost : 9/24/2012 1:15:00 PM    Add-VMHost        The operation for the entity Folder-group-h106735 failed with the following message: "License not available to perform the operation."
+ CategoryInfo          : NotSpecified: (:) [Add-VMHost], NotEnoughLicenses
FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpdates_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.AddVMHost

Now I am uncomfortably stuck in this situation and my only way out is to add those ESXi hosts by hand using the vCenter interface, which I didn't want to use. Of course I checked this problem on the net and found many people talking about the use of Add-VMHost, but nobody talkin' of the discrepancies between the graphical interface and the behavior of the cmdlet... pretty stunning. Am I the first one to look for a way to assing a license to a host by means of this cmdlet?

I found a blog post on, but this guy shows us a way to license a host after having added it to vCenter. Which is not a solution for the problem I have.

I'll keep this post up-to-date if I ever find a way to solve this.

1 comment:

  1. ---- Adding autodeployed ESX 5.0 hosts License Exipred PowerCLI

    Hope this may help you.


Related Posts Plugin for WordPress, Blogger...