If I want to make a graceful shutdown and power-On script, would this script from LucD work?
# Get all powered on VMs in hash table and shutdown vm
Function Get-Devshutdown{
$vmTab = @{}
Get-Folder powershell | Get-Cluster Development | Get-VM | where {$_.PowerState -eq "PoweredOn"} | %{
$vmTab.Add($_.Name,$_)}
$vmTab.Values | %{
$vm = Get-VM -Name $_.VM.Name
Stop-VM -VM $vm -Confirm:$false
}
}
Function Get-Devpowerup{
$vmTab.Values | %{
$vm = Get-VM -Name $_.VM.Name
Start-VM -VM $vm -Confirm:$false
}
}