WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / How to automate adding a license into vCenter Server with custom label? 

How to automate adding a license into vCenter Server with custom label? 

02.06.2023 by William Lam // Leave a Comment

When adding a license key into vCenter Server using the vSphere UI, users have the ability to provide a custom label that is then associated with that specific license key.


This is certainly more useful than the system default label which uses "License N", where N is an incrementing number.

While the majority of license management can be fully automated using the vCenter Server LicenseManager API, adding a license key with a custom label is unfourntately an operation that is currently not possible with the public API.

With that said, there is a way in which you can still automate this operation 🙂

Not to bore you with all the details, but there is a private API for managing licenses with custom labels which is part of the vSphere Lookup Service (LS) API  within vCenter Server. While directly accessing the API through a typical vSphere SDK is not possible, we do have a trick up our sleeve by using the LS Managed Object Browser (MOB) interface, which is similiar to that of the vSphere MOB.

The LS MOB is available under /ls/mob and is also an authenticated endpoint, meaning you must have valid vCenter Server credentials along with the appropriate permissions to perform the given operation. Leveraging the automation I wrote back in 2016 for automating against the vSphere MOB, we can craft a simliar PowerShell script or using any other language which can invoke a web request to automate this specific operation.

I have created the following PowerShell example script called add-vcenter-license-with-label-via-mob.ps1 which you will need to download locally to your desktop and then update the following variables to match those within your enviornment:

  • $vc_server - FQDN/IP Address of your vCenter Server
  • $vc_username - vCenter Server user to perform the license addition
  • $vc_password - vCenter Server password to user account
  • $license_name - Custom label for the license key to add to vCenter Server
  • $license_key - License key to add to vCenter Server

Once you have saved your changes, you can then run the script using the following command:

./add-vcenter-license-with-label-via-mob.ps1


If the operation was successful, you should see simliar output as shown in the screenshot above and you can now refresh the vSphere UI to see your newly license key added with a custom label.

More from my site

  • Quick Tip - Listing vSphere Global Permissions using PowerShell
  • Updated Dashboard for VMware Community Homelabs using Dashimo
  • Quick Tip - VMware Cloud Foundation (VCF) 5.2 provisioning fails with Update SDDC Manager with Licensing Information
  • Downgrading new VMware vSphere Foundation (VVF) or VMware Cloud Foundation (VCF) licenses to 7.x
  • Decoding vSphere (vCenter/ESXi), vSAN & Tanzu License Keys

Categories // Automation, vSphere 7.0, vSphere 8.0 Tags // license, powershell

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...