This script is to guide any customer or VCSP – aka VMware by Broadcom Cloud Service Provider to automate bulk swap of the vSphere, vSAN, and/or NSX licenses based on PowerCLI script as mentioned below.
NOTE: This script does not warrant any official support. You are free to leverage it to your needs with any updates/modifications as required.
Environment
VMware vCenter Server 6.x
VMware vCenter Server 7.x
VMware vCenter Server 8.x
VMware vSphere ESXi 6.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x
VMware vSAN 6.x
VMware vSAN 7.x
VMware vSAN 8.x
VMware NSX T
Resolution
The solution has a single script (attached) that contains two PowerCLI functions:
Update-vSphereAndvSANLicense
Update-NSXNLicense
Prerequisites:
Jump server has connectivity to the vCenter Server
VMware PowerCLI 10.x or greater is installed.
Recommended to validate the script in a non-production environment.
Update the attached .csv files as per your environment.
For vSphere/vSAN enter the Cluster Name and license keys per each line.
For NSX, enter a license key, 1 per line.
For any issues with the Certificates, run following command once in PowerCLI shell: Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
vSphere and vSAN Licensing Updates
In order to run the script you will first need to “dot” source the function from PowerCLI prompt. . ./BulkUpdatevSphereAndvSANAndNSXLicense.ps1
IMPORTANT: This needs to be done every time the script is run. There needs to be a preceeding "." before the "./" in the command.
Connect to the vCenter Server endpoint using the Connect-VIServer cmdlet
In order to run the script you will first need to “dot” source the function from PowerCLI prompt.
. ./BulkUpdatevSphereAndvSANAndNSXLicense.ps1
IMPORTANT: This needs to be done every time the script is run. There needs to be a preceeding "." before the "./" in the command.
For NSX, you’ll need to connect to the vCenter Server endpoint using Connect-NsxtServer cmdlet: Connect-NSXtServer <VC_URL> -User administrator@domain -Password <PASSWORD>
Execute the following command to perform a dry run and to validate the results:
Update-NSXNLicense -CSV ./nsx1.csv
Execute the following command to start the conversion
NOTE: Adding the flag called -RemoveExistingLicenses will remove the existing keys that had existed prior. If you do not add the flag, it’ll simply add the new licenses but leave the existing ones alone.