[PowerCLI] Check Ballooning vCenter wide (quick)

I used the Check Ballooning script allot in the pasted, the script can be found on many blogs and sites. I simply adjusted the script so it would also show Compressed Memory.
Why add “Compressed Memory”?, it gives a extra dimension to the ballooning an swapped values.
Compressed Memory tells you how memory intensive the VM is, so:
Higher compression value then the ballooning or the swapped: Lower priority
Lower compression value then the ballooning or the swapped: Higher priority

The code I use:

$myCol = @()
foreach($vm in (Get-View -ViewType VirtualMachine | Where-Object `
  {$_.Summary.QuickStats.BalloonedMemory -ne "0"})){
    $Details = "" | Select-Object VM, BalloonedMemory ,SwappedMemory ,CompressedMemory
    $Details.VM = $vm.Name
    $Details.BalloonedMemory  = $vm.Summary.QuickStats.BalloonedMemory
    $Details.SwappedMemory    = $vm.Summary.QuickStats.SwappedMemory
    $Details.CompressedMemory = $vm.Summary.QuickStats.CompressedMemory
    $myCol += $Details
  }
$myCol

Based on the script of ICT-Freak.

Leave a Reply

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