VMware Cloud Community
IONVmware
Contributor
Contributor

Start servers if all servers in group are offline

We're testing a new patching method and it turns the servers off when done. Then we need to turn them back on in a specific order. I don't know what command will check to make sure ALL servers are offline before initiating the poweron command. I

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

Are these servers all in a specific folder or do you have a list in one format or another?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
IONVmware
Contributor
Contributor

I can likely put them all in the same folder if that's necessary.

Reply
0 Kudos
LucD
Leadership
Leadership

It would make it easier.
You could insert a While-loop like this for example

while((Get-Folder -Name MyFolder | Get-VM).PowerState -contains 'PoweredOn'){
    sleep 5
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

IONVmware
Contributor
Contributor

I think that should work, let me give it a go, thanks!

Reply
0 Kudos