Using Powershell to make you money

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 :
Name : TEST01
OS : Microsoft Windows 2000 Server

Host :
Name : TEST03
OS : Microsoft Windows 2000 Server

Host :
Name : TEST02
OS : Microsoft Windows 2000 Server

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.