Set the Startup delay?

Feb 11, 2009 at 6:36 AM
Edited Feb 11, 2009 at 12:01 PM
I cannot find a way to set the startup delay for a virtual machine. Is this piece missing from V1.00b? Everything else I thought I could want works brilliantly - I'm a very happy man.

Edit: Found a solution here (which I've tweaked somewhat to do JUST the bare minimum for this function):
$Name = "VMName"
$Query = "Select * from Msvm_ComputerSystem Where ElementName='$Name'"
$DelaySecs = 60
$VSMS = gWMI -class "Msvm_VirtualSystemManagementService" -namespace "root\virtualization"
foreach ($Vm in Get-WmiObject -Namespace root\virtualization -Query $Query)
$SD = gWMI -Namespace root\virtualization -Query "Associators of {$Vm} Where ResultClass=Msvm_VirtualSystemGlobalSettingData AssocClass=Msvm_ElementSettingData"
$SD.AutomaticStartupActionDelay = [System.Management.ManagementDateTimeconverter]::ToDmtfTimeInterval((New-TimeSpan -Seconds $DelaySecs))
$VSMS.ModifyVirtualSystem($Vm, $SD.PSBase.GetText(1))

Maybe this could be added to the Set-VM method for the next release? Set-VM -Delay nn perhaps?
Mar 16, 2009 at 7:24 PM
David, thanks, I didn't do this intially because I hadn't found an easy way to convert the time interval which you've done for me :-)  

I've added it to Set-Vm and it will show up in the 1.00c release.