How to remove a License Manually from vCenter using ldapmodify
search cancel

How to remove a License Manually from vCenter using ldapmodify

book

Article ID: 324302

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This KB will help in removing such Licenses manually from vCenter Server using ldapmodify when the vSphere Client UI License Manager fails to remove the License. ldapmodify is an alternate method to remove a License when the MOB or JXplorer methods are not available to remove a License manually.


Symptoms:
  • An expired license(s) or a removed service leaves a stale license
  • Trying to remove it from vCenter License Manager will not allow removal
  • Delete option is greyed out
  • Unable to use the MOB or JXplorer to remove the license
  • There may also be an Expiring License banner


Environment

VMware vCenter Server Appliance 8.x
VMware vCenter Server Appliance 7.x

Cause

Removing an expired or irrelevant license from vCenter Server fails from vSphere Client GUI and the license persists in the VMware vmdir database.

Resolution

1. Mandatorily ensure that a snapshot and/or backup of the vCenter is in place:

Make sure to take a powered-down snapshot, ESPECIALLY if you have Enhanced Linked Mode (ELM). See "VMware vCenter in Enhanced Linked Mode pre-changes snapshot (online or offline) best practice
When using multiple vCenter's in the same Single Sign On Domain (Enhanced Linked Mode), there is high potential of corruption of the domain if no offline snapshots are taken of all nodes before the changes
If a change must be reverted, all nodes of the Enhanced Linked Mode domain have to be restored back to this offline/consistent snapshot. All nodes must be reverted to the snapshots first, before powering any on.

VM-powered-down-snapshot sequence:
Use the Local ESXi web console on the host(s) that the vCenter VM(s) is/are on > Go to VM > Actions > Do a guest OS shutdown > Take a Snapshot and name it accordingly > Power the VM(s) back up > Await for all services to come back up > Then go through the process of removing the license


2. SSH to vCenter as the root user:

Set bash shell as necessary: Toggling the vCenter Server Appliance default shell


3. List LicenseEntity and AssetEntity:

Note, paste the entire contents of the ldapsearch command on the vCenter bash command line..

vcsa# /opt/likewise/bin/ldapsearch -b "cn=LicenseService,cn=Services,dc=vsphere,dc=local" -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -s sub "(|(objectclass=vmwLicSvcAssetEntity)(objectclass=vmwLicSvcLicenseEntity))" cn vmwLicSvcAssetName vmwLicSvcAssetProductName vmwLicSvcAssetProductVersion vmwLicSvcAssetLicenseId vmwLicSvcLicenseId vmwLicSvcLicenseName vmwLicSvcLicenseSerialKeys -W


When prompted, enter the LDAP Password for [email protected]


Example Output:
(Note, the LicenseEntity vmwLicSvcLicenseId and any AssetEntity using that ID in vmwLicSvcAssetLicenseId. Removing the LicenseEntity will result in the AssetEntity becoming unlicensed and need to be relicensed accordingly)

Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <cn=LicenseService,cn=Services,dc=vsphere,dc=local> with scope subtree
# filter: (|(objectclass=vmwLicSvcAssetEntity)(objectclass=vmwLicSvcLicenseEntity))
# requesting: cn vmwLicSvcAssetName vmwLicSvcAssetProductName
vmwLicSvcAssetProductVersion vmwLicSvcLicenseName vmwLicSvcLicenseSerialKeys
#

# AssetEntity_YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY-YYYYYYYY-YYYY-YYYY-YYYY-YY
YYYYYYYYYY, LicenseService, services, vsphere.local dn: AssetEntity_YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY-YYYYYYYY-YYYY-YYYY-YYYY-YY
 YYYYYYYYYY,cn=LicenseService,cn=services,dc=vsphere,dc=local cn: AssetEntity_YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY-YYYYYYYY-YYYY-YYYY-YYYY-YY
 YYYYYYYYYY
vmwLicSvcAssetName: vcenter.example.org vmwLicSvcAssetProductVersion: 7.0 vmwLicSvcAssetProductName: VMware VirtualCenter Server vmwLicSvcAssetLicenseId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX # LicenseEntity_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, LicenseService, service s, vsphere.local dn: cn=LicenseEntity_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,cn=LicenseService,cn =services,dc=vsphere,dc=local cn: LicenseEntity_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
vmwLicSvcLicenseId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX vmwLicSvcLicenseName: vCenter Server 7 Standard vmwLicSvcLicenseSerialKeys: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX


4. From the previous output, locate the LicenseEntity to remove:

In this example, we will remove, 

dn: cn=LicenseEntity_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,cn=LicenseService,cn =services,dc=vsphere,dc=local

cn: LicenseEntity_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

vmwLicSvcLicenseName: vCenter Server 7 Standard

vmwLicSvcLicenseSerialKeys: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX


Note: Paste the entire contents of the ldapmodify command to the second EOF on the vCenter bash command line. Make sure to have the correct 'dn' of the LicenseEntity to remove...

TIP: Use notepad to prepare the ldapmodify with the correct dn...
(The 4 separate lines below will need to be copied and paste as a whole and not separate lines into the SSH session)

vcsa# /opt/likewise/bin/ldapmodify -h localhost -D "cn=administrator,cn=users,dc=vsphere,dc=local" -W << EOF
dn: cn=LicenseEntity_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,cn=LicenseService,cn=services,dc=vsphere,dc=local
changetype: delete
EOF

Example Output:

Enter the LDAP Password when prompted. Note that the entry is deleted

Enter LDAP Password:
deleting entry "cn=LicenseEntity_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,cn=LicenseService,cn=services,dc=vsphere,dc=local"


5. Verify the LicenseEntity was removed using an ldapsearch query:

Note, paste the entire contents of the ldapsearch command on the vCenter bash command line..

vcsa# /opt/likewise/bin/ldapsearch -b "cn=LicenseService,cn=Services,dc=vsphere,dc=local" -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -s sub "(|(objectclass=vmwLicSvcAssetEntity)(objectclass=vmwLicSvcLicenseEntity))" cn vmwLicSvcAssetName vmwLicSvcAssetProductName vmwLicSvcAssetProductVersion vmwLicSvcAssetLicenseId vmwLicSvcLicenseId vmwLicSvcLicenseName vmwLicSvcLicenseSerialKeys -W


6. Verify from the vSphere Client UI -> Licensing, -> Licenses that the License is removed:
Note, a UI refresh may be needed. A reboot or restart of services is not necessary.

Note, if an Asset Entity was using that License, it will show unlicensed and need to be relicense

           

             

 

Additional Information

Note: Licensed assets using the license will become unlicensed and need to be relicensed accordingly.

This article provides an example to remove a "LicenseEntity". Removing the "AssetEntity" is not required or recommended.

CAUTION: This article shows how to remove a vCenter Server License. DO NOT REMOVE the vCenter Server License if it is valid and in use. Only remove the desired stale or expired LicenseEntity.