VMware Cloud Community
KGadowski
Enthusiast
Enthusiast
Jump to solution

Assigning license to new ESXi host

Hi guys,

I'm currently working on a workflow for provisioning new ESXi hosts from the scratch. Unfortunately I stuck on assigning new VMWare license to a host. I wanted to do this with a below scripting element:

Input:

Host (VC: HostSystem)

License (String)

Code:

Host.configManager.licenseManager.licenseAssignmentManager.updateAssignedLicense(Host.id, License, null);

Unfortunately this returns an error stating licenseManager is null.

Does anyone know how to define new licenseManager on the host or assign a license in some other way?

Thanks,

Kamil

Reply
0 Kudos
1 Solution

Accepted Solutions
KGadowski
Enthusiast
Enthusiast
Jump to solution

OK, I figured this out myself. Instead of approaching licenseManager through Host.configManager I used VC:SdkConnection variable instead.

Input:

Host (VC:HostSystem)

SDK (VC:SdkConnection)

LicenseKey (String)

Code:

SDK.licenseManager.licenseAssignmentManager.updateAssignedLicense(Host.id, LicenseKey, null);

This works perfectly!

View solution in original post

Reply
0 Kudos
1 Reply
KGadowski
Enthusiast
Enthusiast
Jump to solution

OK, I figured this out myself. Instead of approaching licenseManager through Host.configManager I used VC:SdkConnection variable instead.

Input:

Host (VC:HostSystem)

SDK (VC:SdkConnection)

LicenseKey (String)

Code:

SDK.licenseManager.licenseAssignmentManager.updateAssignedLicense(Host.id, LicenseKey, null);

This works perfectly!

Reply
0 Kudos