• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Yellow Bricks

by Duncan Epping

  • Home
  • Unexplored Territory Podcast
  • HA Deepdive
  • ESXTOP
  • Stickers/Shirts
  • Privacy Policy
  • About
  • Show Search
Hide Search

Check if your license server is still running…

Duncan Epping · May 12, 2009 ·

After I wrote the licensing server post a couple of days back one of my colleagues(Thanks Horst!) was so kind to email me the following script. What it basically does is check every server for the availability of the license source. Of course it can be improved by adding for instance a check to see if the license service is running on the license server and for instance email the results if there’s an error…I will leave that up to the powershell guru’s like mr Renouf. Here’s the script:

# This script checks the availability of the configured license source for all ESX hosts that are managed by a given VC
# The script assumes that there is a user account that has the same password on all hosts
# It is higly recommended to use an account that has a read-only role
# The first credential pop-up is for VC, the second for ESX hosts
connect-viserver <VC>
$vmhosts = Get-VMHost
Disconnect-VIServer -Confirm:$false
$numhosts = $vmhosts.Length
if ($numhosts -eq 0) { exit 1 }
$credential = Get-Credential
$availability = @{}
$badcounter = 0;
$hostcounter = 1
$vmhosts | foreach {
$progress = [int] ($hostcounter * 100 / $numhosts)
Write-Progress “Checking license source availability” “Checking Host” -PercentComplete $progress -CurrentOperation “Checking host $_”
connect-VIServer $_.name -Credential $credential
$svcRef = new-object VMware.Vim.ManagedObjectReference;
$svcRef.Type = “ServiceInstance”;
$svcRef.Value = “ServiceInstance”;
$serviceInstance = get-view $svcRef;
$lic_ref = $serviceInstance.content.licensemanager;
$LM = Get-View $lic_ref;
$available = $LM.SourceAvailable
$availability[$_.Name] = $available
if ($available -eq $false ) { $badcounter++ }
Disconnect-VIServer -Confirm:$false
$hostcounter++
}
Write-Host $badcounter ” Hosts without available license source.”
foreach ($item in $availability.GetEnumerator() )
{
if ($item.value -eq $False ) {Write-Host “Host ” $item.name ” does not have a valid license source” }
}

Related

Management & Automation, Server powershell, Scripting, scripts

Reader Interactions

Comments

  1. William says

    12 May, 2009 at 19:21

    Something similar using the Perl and the VI Perl Toolkit: http://engr.ucsb.edu/~duonglt/vmware/checkLicenseServer.pl

    [vi-admin@vima ~]$ ./checkLicenseServer.pl –server resvc.resnet.ucsb.edu –username primp
    Enter password:
    License Server available: true
    Querying hosts …
    All hosts are licensed!

    [vi-admin@vima ~]$ ./checkLicenseServer.pl –server reflex.primp-industries.com –username primp
    Enter password:
    Checking License Server: 27000@reflex.primp-industries.com
    License Source availability false
    License Server is down!

    It will first check License Server to ensure it’s running and available and then query each of the host(s) and only print host(s) that do not have a license source available.

    –William

Primary Sidebar

About the Author

Duncan Epping is a Chief Technologist and Distinguished Engineering Architect at Broadcom. Besides writing on Yellow-Bricks, Duncan is the co-author of the vSAN Deep Dive and the vSphere Clustering Deep Dive book series. Duncan is also the host of the Unexplored Territory Podcast.

Follow Us

  • X
  • Spotify
  • RSS Feed
  • LinkedIn

Recommended Book(s)

Advertisements




Copyright Yellow-Bricks.com © 2025 · Log in