Problem solve Get help with specific problems with your technologies, process and projects.

PowersHell: Adding an ESX host and Licensing it

PowersHell: Adding an ESX host and Licensing it

Well, the licensing part of this took me the better part of day to work out. That’s because I’m more or less crap...

at decoding the API SDK reference guide:

My favourite part of the license script is the $licassman variable. It could be used to describe a number of people I’ve worked with… 

I want learned today is the add-host cmd-let has new parameter it didn’t have in the beta/RC1 of vSphere4. The -force switch is used to accept the default/untrusted SSL SHA certificate that comes from clean installation/first boot of an ESX host.

$vmhost = “”

add-vmhost $vmhost -location (get-datacenter -name ‘SanFran DataCenter’ | get-folder -name ‘AMD Hosts’ | get-cluster -name ‘AMD Cluster 2′) -user root -password password -force: $true

$targethostMoRef = (get-VMHost $vmhost  | get-view).MoRef
$si = Get-View ServiceInstance
$LicManView=Get-View $LicManRef
$licassman = Get-View $LicManView.LicenseAssignmentManager
$licassman.UpdateAssignedLicense($targethostMoRef.value,”YOUR LIC KEY”,”vSphere4 Enterprise Plus (1-12 cores per CPU”)

Dig Deeper on VMware Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.