In vCenter (Home – Administration – Licensing) more licenses were assigned than in use by the ESXi Hosts and the license count is displayed as negative:

The reason was a duplicate entry in the ADAM Database. To correct this you need to install the Windows Support Tools.

Solution:

• connect to your vCenter Server per RDP
• run ldp.exe (Windows Support Tools)
• “Connection” -> “Connect” -> connect to “localhost”
• “Connection” -> “Bind” -> leave it default -> OK
• “View” – “Tree” -> leave BaseDN blank -> OK
• drill down to “DC=virtualcenter,DC=vmware,DC=int”
• drill down to “OU=Licensing,DC=virtualcenter,DC=vmware,DC=int”
• drill down to “OU=LicenseEntities,OU=Licensing,DC=virtualcenter,DC=vmware,DC=int”

Here the Host ID of all ESXi Hosts will be displayed:

eg: CN=host-34321:6704E… -> Host ID = 34321

Now open the SQL Management Studio and connect to your vCenter Server Database.

Run the following query for each Host ID displayed in your ADAM database.
Note that you have to use your host IDs – not the one from this example:

(Select * from VPX_ENTITY where id = 34321)

If the host ID is valid, the name of the ESXi Host will be displayed:

If the result is blank you have found the duplicate entry:

Now you can delete this ID from your ADAM database.

To do so, mark the Host ID in ldp.exe, rightclick and select “delete”:

If you restart your vCenter it will correctly display the amount of licenses.