VMware by Broadcom Cloud Service Provider (VCSP) script for bulk swapping vSphere, vSAN and/or NSX licenses
search cancel

VMware by Broadcom Cloud Service Provider (VCSP) script for bulk swapping vSphere, vSAN and/or NSX licenses

book

Article ID: 370419

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware NSX VMware vCenter Server VMware vSAN

Issue/Introduction

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

  1. 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.

  2. Connect to the vCenter Server endpoint using the Connect-VIServer cmdlet

    Connect-VIServer <VC_URL> -User administrator@domain -Password <PASSWORD>

  3. Execute the following command for a dryrun of the conversion

    Update-vSphereAndvSANLicense -CSV ./vc.template.csv -Dryrun $true -ShowLicenses

  4. Validate the dryrun output and if accurate, you can execute the following command with -Dryrun $false to do the conversion

    Update-vSphereAndvSANLicense -CSV ./vc.template.csv -Dryrun $false 

NSX Licensing Updates

  1. 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.

  2. 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>


  3. Execute the following command to perform a dry run and to validate the results:

    Update-NSXNLicense -CSV ./nsx1.csv

  4. 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. 

    Update-NSXNLicense -CSV ./nsx1.csv -Dryrun $false -RemoveExistingLicenses

Additional Information

NOTE: This script does not warrant any official support. You are free to modify and leverage this script as per your needs.

Attachments

Bulk_License_Update-v1.0.zip get_app