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 = “esx4.vi4book.com”
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
$licassman = Get-View $LicManView.LicenseAssignmentManager
$licassman.UpdateAssignedLicense($targethostMoRef.value,”YOUR LIC KEY”,”vSphere4 Enterprise Plus (1-12 cores per CPU”)