steand2
Contributor
Contributor

Maintenance mode for blade servers with PowerCLI

I am trying to get a bunch of blade servers at batches to get into maintenance mode so that we do not flood the network.

I have not found any good examples for doing this, all the examples are just for one server at the time.

Like group #1

xx-xx-01

xx-xx-03

xx-xx-04

Like group #2

xx-yy-02

xx-yy-04

xx-yy-06

Anyone with insight on how to do this efficiently would be good.

Thanks community.

0 Kudos
2 Replies
dbalcaraz
Expert
Expert

Do you mean something like:

$task = Get-VMHost -Name  [patternameofHosts] | Set-VMHost -State Maintenance -RunAsync

Get-DrsRecommendation -Cluster $cluster | where {$_.Reason -eq "Host is entering maintenance mode"} | Apply-DrsRecommendation

Wait-Task $task

Get-VMHost -Name  [patternameofHosts] | Set-VMHost -State Connected

This should do the hosts that you want, apply recommendations (move VMs) and then connect the ESXi hosts (exit maintenance mode).

-------------------------------------------------------- "I greet each challenge with expectation"
0 Kudos
steand2
Contributor
Contributor

And if the pattern is different and the last digits are odd or even in sequal how would that pattern be applicable?

I would like the first first phase of blade servers to be done and after continue on with the next phase and so forth with more blade servers.

This would for example allow us to do maintenance at one site at the time and then ofcourse revert once we are done with site A.

0 Kudos