Fix catching "Start-VM" exceptions on Hyper-V during starting up VM

This commit is contained in:
Tomas Srnka 2015-01-04 00:05:50 +01:00
parent f9ce1cc4ca
commit 2620042c26
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ forEach ($module in $modules) { . $module }
try {
$vm = Get-VM -Id $VmId -ErrorAction "stop"
Start-VM $vm
Start-VM $vm -ErrorAction "stop"
$state = $vm.state
$status = $vm.status
$name = $vm.name
@ -24,4 +24,4 @@ try {
}
catch {
Write-Error-Message "Failed to start a VM $_"
}
}