Hi,
I'm looking for a way to start one specific VM only if another specific VM is powered off.
I've tried to create a simple script for this but it didn't work.
To me it should be something like getting the power state of VM1, if that is powered off, then it should start VM2
Is this possible?
regards.
Do you mean something like this ?
if((Get-VM -Name vm1).PowerState -eq "PoweredOn" -and (Get-VM -Name vm2).PowerState -eq "PoweredOff"){ Get-VM vm2 | Start-VM -Confirm:$false
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Do you mean something like this ?
if((Get-VM -Name vm1).PowerState -eq "PoweredOn" -and (Get-VM -Name vm2).PowerState -eq "PoweredOff"){ Get-VM vm2 | Start-VM -Confirm:$false
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Tested it and it worked by changing it a little bit.
Thanks!