-
1. Re: PowerCLI License Manager-UpdateAssignedLicense
SonNguyen1 Oct 24, 2018 11:35 AM (in response to SonNguyen1)My fault, I didnt have VSAN enable on that particular cluster yet. For future reference though its the data in $datacenterMoRef.
-
2. Re: PowerCLI License Manager-UpdateAssignedLicense
LucD Oct 24, 2018 11:49 AM (in response to SonNguyen1)Works for me.
Note that the I changed the -contains to a -match, and I use the MoRef.
$clusterName = 'MyCluster'$LicenseManager= Get-View $global:DefaultVIServer.ExtensionData.Content.LicenseManager
$LicenseAssignmentManager= Get-View $LicenseManager.LicenseAssignmentManager
$cluster = Get-Cluster -Server $server -Name $clusterName
foreach($license in $LicenseManager.Licenses){
if($license.Name -match "VSAN"){
if($license.Total -gt $license.Used){
$vsanLicenseKey = $license.LicenseKey
}
}
}
$LicenseAssignmentManager.UpdateAssignedLicense($cluster.ExtensionData.MoRef,$vsanLicenseKey,"VSAN")
-
3. Re: PowerCLI License Manager-UpdateAssignedLicense
konfigurationkingJP Nov 12, 2019 7:30 AM (in response to SonNguyen1)I am getting the same error and I see in the cluster view that VSAN is enabled
get-cluster | select vsanenabled
VsanEnabled : True
I don't understand what you mean by data in $datacenterMoRef
-
4. Re: PowerCLI License Manager-UpdateAssignedLicense
konfigurationkingJP Nov 12, 2019 7:31 AM (in response to LucD)Would you know any other reasons why this would be generating the same error above for me?
-
5. Re: PowerCLI License Manager-UpdateAssignedLicense
LucD Nov 12, 2019 7:39 AM (in response to konfigurationkingJP)The 1st parameter ($cluster.ExtensionData.MoRef) on the method call.
No, not really.
You could check in the vpxd log, there might be some info available. -
6. Re: PowerCLI License Manager-UpdateAssignedLicense
konfigurationkingJP Nov 12, 2019 1:22 PM (in response to LucD)This was a really fun issue but as per your example does not work for us. We had to expand the value of the key-value pair for the $cluster.ExtensionData.MoRef which worked for us.
Here is the VC/Powercli version:
Version : 6.7.1
Build : 10244857
PowerCLI Version
----------------
VMware PowerCLI 6.5 Release 1 build 4624819
-
7. Re: PowerCLI License Manager-UpdateAssignedLicense
LucD Nov 12, 2019 2:23 PM (in response to konfigurationkingJP)That is a rather old PowerCLI version.
I would suggest upgrading, see Welcome PowerCLI to the PowerShell Gallery – Install Process Updates for instructions on that