Just Another IT Blog

It's time to share some of my experiences, crazy ideas, tips and tricks !!!

Post Page Advertisement [Top]

Do you think using the Licensing tab for checking what features are licensed on each host kind of frustrating?

Welcome aboard!!!

I created a powerCLI script which will dump ESX 3.5 Licensing usage into a csv file, so you can import into Excel and play with it.

Here it’s:

$path = ".\ResultESX.txt"

$ESXHosts = Get-VMHost |Get-View

$ServiceInstance = Get-View ServiceInstance
$LicenseMan = Get-View $ServiceInstance.Content.LicenseManager
$Query = $LicenseMan.QueryLicenseUsage
foreach ($ESXHost in $ESXHosts)
{
$LicUse = $LicenseMan.QueryLicenseUsage($ESXHost.MoRef)
Write-Host -ForegroundColor Yellow $ESXHost.Name
Write-Host "License Server: $($LicUse.Source.LicenseServer)"
$resultWrite = $ESXHost.Name + ";" + "License Server: $($LicUse.Source.LicenseServer);"
foreach ($Reservation in ($LicUse.ReservationInfo |Sort Key))
{
If ($Reservation.State-eq "licensed")
{
switch ($Reservation.key)
{
"esxFull" {$FriendlyName = "ESX Server Standard"; break}
"esxExpress" {$FriendlyName = "ESX Server Foundation"; break}
"backup" {$FriendlyName = "VMware Consolidated Backup Usage"; break}
"vmotion" {$FriendlyName = "VMotion"; break}
"drs" {$FriendlyName = "VMware DRS"; break}
"das" {$FriendlyName = "VMware HA"; break}
"esxHost" {$FriendlyName = "VirtualCenter Agent for ESX Server"; break}
"nas" {$FriendlyName = "NAS Usage"; break}
"iscsi" {$FriendlyName = "ISCSI Usage"; break}
"san" {$FriendlyName = "SAN Usage"; break}
"vsmp" {$FriendlyName = "Up to 4-way SMP"; break}
default {$Friendlyname = "Feature not yet in script";break}
}
$resultWrite = $resultWrite + ";$FriendlyName licensed for $($Reservation.Required) Processors"
}
}
Add-Content $path $resultWrite
}

If you have no idea how to start, take a look at PowerCLI Basics

Bottom Ad [Post Page]