PowerShell, Hyper-V: Controlling Automatic Start in Batches

In my environment, I have a lot of very large hyper-v hosts and each can contain 100+ VM's. These VM's are partly managed by another system that can turn them on and off depending on things like whether or not a client has paid their bill etc.

I need to ensure that in the event of the host rebooting, for whatever reason, the virtual machines return to the same state they were in before the reboot event, and I need to make sure that if they are powering on in large amounts, they are not causing a boot storm generally wrecking the whole system.

I need things to come on in nice predefnied controlled batches.

$VPSS = Get-VM
$StartDelay = 0 # initlal startup pause duration
$vmcount = 0

foreach ($VPS in $VPSS)

{
set-vm -name $VPS.Name -AutomaticStartAction StartIfRunning -AutomaticStartDelay 

$vmcount ++


if ($vmcount % 5 -eq 0) # 5 is the number of VM's the script sets before it increases the startup pause duration
    {

    $StartDelay = $StartDelay + 30 # encreases the startup pause duration by 30 seconds
    }

}