Is there a way to take the script Alan has provided in the below link and pipe the output into a Selection menu?
I'm working on a build script and would like to display the available licenses in the vCenter to attach to a host. Then make the selection and add the key.
http://blogs.vmware.com/vipowershell/2012/05/retrieving-license-keys-from-multiple-vcenters.html
# Get the license info from each VC in turn
$vSphereLicInfo = @()
$ServiceInstance = Get-View ServiceInstance
Foreach ($LicenseMan in Get-View ($ServiceInstance | Select -First 1).Content.LicenseManager) {
Foreach ($License in ($LicenseMan | Select -ExpandProperty Licenses)) {
$Details = "" |Select VC, Name, Key, Total, Used, ExpirationDate , Information
$Details.VC = ([Uri]$LicenseMan.Client.ServiceUrl).Host
$Details.Name= $License.Name
$Details.Key= $License.LicenseKey
$Details.Total= $License.Total
$Details.Used= $License.Used
$Details.Information= $License.Labels | Select -expand Value
$Details.ExpirationDate = $License.Properties | Where { $_.key -eq "expirationDate" } | Select -ExpandProperty Value
$vSphereLicInfo += $Details
}
}
$vSphereLicInfo | Format-Table -AutoSize