I have a script that is being used to shut down a UCS blade server - here is a code snip:
try {
if ( $ProfileFull.Operstate -eq "ok" ) {
Get-UcsServiceProfile $ProfileId | Set-UcsServerPower -State soft-shut-down -force
start-sleep -s 120
wait 150
}
#########
I want to change the code to add in a while loop that waits for the blade to power off... what is the best way to do that? Would this work?
try {
if ( $ProfileFull.Operstate -eq "ok" ) {
Get-UcsServiceProfile $ProfileId | Set-UcsServerPower -State soft-shut-down -force
$bladeDn = $ProfileFull.PnDn
while ( Get-ucsblade | ?{$_.Dn -eq $bladeDn } ?{$_.OperPower -eq "on" ) {
start-sleep -s 120
}
}