Changing your VMware license server
Hi everybody, I’m back!
Before you ask, I’ve had a great holiday, thank you. Now let’s continue having fun with Powershell and the VI Toolkit!
I’ve showed you a trick earlier that allows you to find your Virtual Center Server Settings. The License Server settings for instance. But changing these settings can prove to be quite a challenge. Let’s take a look:
$SI = Get-View ServiceInstance
$LicMan = Get-View $SI.Content.LicenseManager
This is the way we connected to the License Manager. Get-Member shows us that the $LicMan variable has a method called ConfigureLicenseSource. This method required two parameters: first a reference to the ESX server and second an object with the new license server settings.
The “managed object reference” to the ESX server took some time to figure out, but it’s actually quite easy:
$ESXServerName = “ESXSERVER01″
$VMHost = Get-VMHost $ESXServerName
$hostref = ($VMHost | Get-View).MoRef
By now, you should know how to use Get-View a bit. The resulting object has a MoRef property which can be used in the ConfigureLicenseSource method.
The object containing the new license settings was also a bit of a puzzle. The method shows it wants an object of type “LicenseSource”. But after consulting the VMware Infrastructure API Reference, I found this type of object has no properties! Then how to set the license server name and port?
More searching yielded a different type of object “LicenseServerSource”. This object type has a property called LicenseServer, which accepts a string as input. This object extends the LicenseSource object (according to the API Reference) and it turns out you can use it in the method:
$LicServer = “27000@LicenseServer.domain.local”
$licsrc = New-Object VMware.Vim.LicenseServerSource
$licsrc.LicenseServer = $LicServer
Now we have all the info we need, and we can execute the method:
$LicMan.ConfigureLicenseSource($hostref,$licsrc)
Enjoy!
6 Responses to Changing your VMware license server
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenArchives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008





Keep em coming !
[...] like how his article on configuring the license server doesn’t assume much and walks you through the [...]
This is great. What about changing the license server of every ESX host in a given Virtual Center?
@Ryan Simply create a loop around the script that handles all VMHosts. Like so:
==================
Connect-VIServer “MYVCSERVER”
ForEach ($VMHost in Get-VMHost)
{
CODE TO CHANGE LICENSE SERVER (copy/paste from quotes and remove the line that starts with $VMHost= )
}
Disconnect-VIServer -Confirm:$False
==================
Is that what you were looking for?
Hugo
Just what i needed, Many thanks
You’re welcome, Lee.
Thanks for commenting.
Hugo