For Emergency case Shutdown all Running VM’s

In case (Power Lost, Backup Power Won’t Start, UPS battery gone bad) it’s fine that you have a that will every

######################################################################
# All VM’s at Once case
######################################################################>
CLS
# write-host R0; All VM’s at Once caseR1;
$viserver = Read-Host ‘What is the name of the Server?’

$choice = R0;”
while ($choice -notmatch R0;[y|n]”){
     $choice = read-host R0;ARE YOU SURE ALL VM’s WILL SHUTDOWN? (Y/N)”
     }

if ($choice -eq R0;y”){
     Connect-VIServer $viserver
     $vmservers=Get-VM | Where-Object {$_.powerstate -eq ‘PoweredOn’}
     $vmservers | -VMGuest -Confirm:$
     }

Translate »
%d bloggers like this: