Merge pull request #5102 from tomassrnka/master
Fix catching "Start-VM" exceptions on Hyper-V during starting up VM
This commit is contained in:
commit
9ce626854d
|
@ -10,7 +10,7 @@ forEach ($module in $modules) { . $module }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$vm = Get-VM -Id $VmId -ErrorAction "stop"
|
$vm = Get-VM -Id $VmId -ErrorAction "stop"
|
||||||
Start-VM $vm
|
Start-VM $vm -ErrorAction "stop"
|
||||||
$state = $vm.state
|
$state = $vm.state
|
||||||
$status = $vm.status
|
$status = $vm.status
|
||||||
$name = $vm.name
|
$name = $vm.name
|
||||||
|
@ -24,4 +24,4 @@ try {
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Error-Message "Failed to start a VM $_"
|
Write-Error-Message "Failed to start a VM $_"
|
||||||
}
|
}
|
Loading…
Reference in New Issue