Which VMs set your Slot Size ?

A previous post on my blog shows us how to get the slot size information for each cluster which has HA enabled, it also discusses what a slot size is and points to some further reading on Yellow-Bricks.

Readers of the great HA and DRS book will know exactly what a slot size is, if you are unsure then I suggest you read my previous article or the HA and DRS book, it is important information to know.

But which VMs are setting your slot size ?  This is a question which was emailed to me over a year ago, someone had issues finding the VMs which were setting their slot size and they had run out – not a good place to be.

I wrote a script for them and asked them to test it, then I completely forgot about it – until recently when the question came up again.

Now you probably think you know which VM’s are setting your slot size but the thing that struck me is that nearly all the people I asked to check this came back with the same comments:

Yep, it works and wow, I had forgotten about that machine and the resources I allocated to it !

So please, download it and give it a go, who knows you too may have a surprise.


Sample Results


Video Walkthrough



Make sure you change the connection details in the first line.

Connect-VIServer MyVIServer

foreach ($Cluster in Get-Cluster){
	if($cluster.HAFailoverLevel -gt 0){
		$SlotDetails = $Cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo()
		$Details = "" | Select Cluster, TotalSlots, UsedSlots, AvailableSlots, SlotNumvCPUs, SlotCPUMHz,SlotMemoryMB
		$Details.Cluster = $Cluster.Name
		$Details.TotalSlots = $SlotDetails.TotalSlots
		$Details.UsedSlots = $SlotDetails.UsedSlots
		$Details.AvailableSlots = $SlotDetails.TotalSlots - $SlotDetails.UsedSlots
		$Details.SlotNumvCPUs = $SlotDetails.SlotInfo.NumvCpus
		$Details.SlotCPUMHz = $SlotDetails.SlotInfo.CpuMHz
		$Details.SlotMemoryMB = $SlotDetails.SlotInfo.MemoryMB

		Write-Host -ForegroundColor Green "`nSlot info for $($Cluster.Name) cluster, NumberofCPUs: $($SlotDetails.SlotInfo.NumvCpus)	SlotCPUMhz: $($SlotDetails.SlotInfo.CpuMHz) SlotMemoryMB: $($SlotDetails.SlotInfo.MemoryMB)	"

		$vms = Get-VM -Location $cluster

		if ($SlotDetails.SlotInfo.CpuMHz -eq "256"){
			Write "Default CPU slot size of 256Mhz found"
			foreach ($VM in $vms){
				foreach ($Suspected in ($VM | where { $_.NumCPU -eq $SlotDetails.SlotInfo.NumvCpus })) {
					Write "Suspected CPU Count match: $($VM.Name)"
		} else {
			foreach ($VM in $vms){
				foreach ($Suspected in ($VM | Get-VMResourceConfiguration | where { $_.CPUReservationMhz -eq $SlotDetails.SlotInfo.CpuMHz })) {
					Write "Suspected CPU match: $($VM.Name)"
		foreach ($VM in $vms){
			$MemResAndOverhead = 0
			$MemRes = (($VM | Get-VMResourceConfiguration).MemReservationMB)
			$MemOver = [Math]::Round(($VM.ExtensionData.Runtime.MemoryOverhead / 1MB +1))
			$MemResAndOverhead = $MemRes + $MemOver
			if (($MemResAndOverhead) -ge ($SlotDetails.SlotInfo.MemoryMB)) {
				Write "Suspected Memory match: $($VM.Name)"
		Write-Host -ForegroundColor Yellow "`nCluster $($cluster.Name) has no fail-over level defined" 

10 thoughts on “Which VMs set your Slot Size ?

  1. Ken

    We are on Vmware 5.1 and when I tried running your script the “NumberCPUs:”, “slotCPUMhz;” and “slotMemoryMB:” fields were blank. Any suggestions?


  2. Jeff

    After doing some more reading today, I found it was in the copy/paste process I performed. Corrected this in the PowerGUI utility and ran the script successfully. Regardless, thank you for the reply and there may be some further inquiries from me in relation to the great topics you have here. Thank you for all of this!

    — Jeff

  3. Jeff

    I’m just now working on utilizing PowerCLI in my environments. When I attempt to run this script after installing vSphere PowerCLI 4.1, I get the following:

    [vSphere PowerCLI] C:\Users\kowalkjg\Downloads\scripts> .\SlotSizeInfo2.ps1
    Unexpected token ‘Connect-VIServer’ in expression or statement.
    At C:\Users\name\Downloads\scripts\SlotSizeInfo2.ps1:1 char:19
    + 1 Connect-VIServer <<<< myviserver.domain.net
    + CategoryInfo : ParserError: (Connect-VIServer:String) [], Parse
    + FullyQualifiedErrorId : UnexpectedToken

    Probably a newbish question, but I have to start somewhere. Any assistance would be appreciated. Thank you!

  4. Bill

    Getting error

    You cannot call a method on a null-valued expression.
    At W:\Slotsize.ps1:5 char:71
    + $SlotDetails = $Cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo
    <<<< ()
    + CategoryInfo : InvalidOperation: (RetrieveDasAdvancedRuntimeInf
    o:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Slot info for MyCluster1 cluster, NumberofCPUs: SlotCPUMhz: SlotMemoryMB:

    Lists all of my vms, then moves on to next cluster with same error.

  5. Eugene

    Ok so changing admission control policy to per host as opposed to per percentage based allows me to run the script and display results.

  6. Eugene

    I tried to run this on my vcenter. I have two clusters and am getting results for one of them but for the second cluster I get this: Cluster cluster_name has no fail-over level defined. This is on a 13 host cluster with admission control enabled, percentage based set to 16%.

  7. Virtu-Al

    Thanks for your comment, I have changed the display now so you should get the option to download the script at the top right when you move your mouse over the code.

    Let me know if this doesnt work.

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.