Quantcast
Viewing all articles
Browse latest Browse all 185049

Re: detailed information with start-vm

If you only want to see a message when the start fails, you would be better off with a Try-Catch construct.

Something like this

 

$vmName="MyVM"
try {
 
$ProgressPreference="SilentlyContinue"
 
$vm=Get-VM-Name$vmName-ErrorActionSilentlyContinue
 
Start-VM-VM$vm-ErrorActionSilentlyContinue|Out-Null
}
catch {
 
"$vmName failed to start"
}

Viewing all articles
Browse latest Browse all 185049

Trending Articles