We recently had to get some lists together for the Licensing department as there are virtualisation deals which can be used to reduce the amount of licensing costs for your VM’s.
Im not sure what they are this week but last time I checked you could license all VM’s on one host with 1 Data center license. I think there are also deals for 3 vm’s per Enterprise license or similar ?
So with the following powershell script we were able to integrate the VI toolkit with WMI information to gain the information needed…
connect-viserver MYVISERVER
$vms = Get-VM | select-object Name, Host
$myCol = @()
foreach ($vm in $vms)
{
$MyDetails = “” | select-Object Host, Name, OS
$MyDetails.Host = $vm.Host
$MyDetails.Name = $vm.Name
$OSDetails = Get-WmiObject -class Win32_OperatingSystem -computername $vm.Name
$MyDetails.OS = $OSDetails.Caption
$myCol += $MyDetails
}
$myCol | sort Host
Sample output:
Host : HOST01.TEST.gov.uk
Name : TEST01
OS : Microsoft Windows 2000 Server
Host : HOST01.TEST.gov.uk
Name : TEST03
OS : Microsoft Windows 2000 Server
Host : HOST02.TEST.gov.uk
Name : TEST02
OS : Microsoft Windows 2000 Server