Hyper-V 3 Resource Metering

Well I’ve been working on this project and I found it interesting to share a little script which I created for that purpose:

 

  1. Enable-VMResourceMetering
  2. Measure-VM

And you’re ready to run the script:

</pre>
if("C:\VMMeasures.html" > 1) {del C:\VMMeasures.html}
$date = date
$a = "<title>VM Measures @ $date</title>"
$a = $a + "<style>"
$a = $a + "body{background-color:grey;color:#ffffff;font-family:Verdana;}"
$a = $a + "table{border-width: 1px;border-style: solid;border-color: black;border-collapse: separate;border-spacing:4px;}"
$a = $a + "th{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:black;text-align:center;}"
$a = $a + "td{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:#012456;text-align:center;}"
$a = $a + "i{color:#000000;}"
$a = $a + "</style>"
$vhost1 = Get-VMHost -ComputerName <Hyper-V Host> | Select-Object Name
$vhost2 = Get-VMHost -ComputerName <Hper-V Host> | Select-Object Name

Get-VM -ComputerName $vhost1, $vhost2 | Measure-VM | Select-Object ComputerName, VMName, AverageProcessorUsage, AverageMemoryUsage, MaximumMemoryUsage, MinimumMemoryUsage, TotalDiskAllocation, AvgCPU, AvgRAM, MinRAM, MaxRAM, TotalDisk | ConvertTo-HTML -Head $a -Body "<H2>VM Measures @ $date on <i>$vhost1</i> and <i>$vhost2</i></H2>" | Out-File "C:\VMMeasures.html"
Invoke-Expression C:\VMMeasures.html
<pre>

For something better and more elite I suggest you would go over here “http://poshstats.net/” but if you’re like me and just can’t keep your fingers of anything you encounter good ;-).
(Abdullah)^2

3210 Total Views 6 Views Today

Abdullah

Knowledge is limitless.

Leave a Reply

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