Check available CPU reserve under Virtual Server

Today I have a very simple script:

Set vs = CreateObject("VirtualServer.Application")

Wscript.Echo "Available system capacity: " & vs.AvailableSystemCapacity

This will report the available system capacity as a percent. Note that this is specifically refering to the ability to reserve CPU resource for a virtual machine - and not how much CPU resource is actually being used. By default virtual machines have a CPU reserve of 0%. You could have any number of these virtual machines running - and still have this script report that 100% CPU reserves were available (as this is technically true). Though once you start setting CPU reserves on virtual machines - this script will tell you exactly how much CPU capacity you have left.

Cheers,
Ben