VMware Cloud Community
BasavarajPM
Contributor
Contributor

powercli: LicenseManager, UpdateLicense method(vSphere API)

Hi,

I have written the following script:

[script]

------------------------------------

Connect-VIServer <ServerIP> -User <Username> -Password <password>

$servInst = Get-View ServiceInstance

$licMgr = Get-View $servInst.Content.licenseManager

$licenseToBeUpdated= "6J4VP-EPH1N-R8860-083U4-2KYN2"

$licencesPresent= $licMgr.Licenses

$label = New-Object VMware.Vim.keyValue

$label.Key = "Name"

$label.Value = "Standard"

foreach($lp in $licencesPresent)

{

if($lp.LicenseKey -eq $licenseToBeUpdated){

Write-Output ("license found")

$licMgr.UpdateLicense($lp.LicenseKey, $label)

}

}

----------------------------------------------------------------------

I have few questions:

>> How to pass the key/value parameter to the UpdateLicense method

Update license takes the license key as first argument and the label(key, value) as second parameter

In what format can we pass the parameter


>> When i try to see the labels associated with a particular license Object

i see an empty list

in this case how do I update the name of the license

is the license's name considered to be a label?

Thank you,

Basu

Tags (2)
0 Kudos
4 Replies
LucD
Leadership
Leadership

Is this in a pre-vSphere 6.x environment, or in vSphere 6.x ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BasavarajPM
Contributor
Contributor

Hi LuCD,


It's in vSphere 6.0 with PowerCLI 6.0

0 Kudos
LucD
Leadership
Leadership

In vSphere 6.x you will have to use the Get-LicenseDataManager cmdlet to manage licenses.

That is in vSphere 6.x your only option at the time beiong, afaik, to interact with cis.license.management.SystemManagementService


The Label option hasn't been made available, or doesn't exist anymore, afaik.

See the Examples in the cmdlet's Help.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BasavarajPM
Contributor
Contributor

I didn't have any desired output from Get-LicenseDataManager cmdlet Or LicenseDataManager , can you please share the script for my question: "When adding license I need to modify/add  Name."

Thanks

0 Kudos