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

Yellow Bricks

by Duncan Epping

  • Home
  • 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” }
}

Share it:

  • Tweet

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

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

    [[email protected] ~]$ ./checkLicenseServer.pl –server reflex.primp-industries.com –username primp
    Enter password:
    Checking License Server: [email protected]
    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 in the Office of CTO of the Cloud Platform BU at VMware. He is a VCDX (# 007), the author of the "vSAN Deep Dive", the “vSphere Clustering Technical Deep Dive” series, and the host of the "Unexplored Territory" podcast.

Upcoming Events

Feb 9th – Irish VMUG
Feb 23rd – Swiss VMUG
March 7th – Dutch VMUG
May 24th – VMUG Poland
June 1st – VMUG Belgium

Recommended Reads

Sponsors

Want to support Yellow-Bricks? Buy an advert!

Advertisements

Copyright Yellow-Bricks.com © 2023 · Log in