Tsu-Sheng Tsao | James,
This is what I use, you can try it.
########################################################################
# Import the Cisco UCS PowerTool module Import-Module CiscoUcsPS
# Connect to a UCS system $passwd = ConvertTo-SecureString "password" -AsPlainText -Force $ucsmcreds = New-Object System.Management.Automation.PSCredential ("admin", $passwd) $handle = Connect-Ucs 192.168.1.1 -Credential $ucsmcreds
# Send command # Excludes service profile which is not associated to any server # If power is already down, no need to shutdown again Get-UcsBlade | % { If (($_.AssignedToDn -ne "") -and ($_.OperPower -ne "off")) { Write-Host "Shutting down" + "["$_.AssignedToDn"]..." Get-UcsServiceProfile -Dn $_.AssignedToDn | Set-UcsServerPower -State "soft-shut-down" -Force Write-Host } }
Write-Host "All done."
Disconnect-Ucs
######################################################################## |
| Please sign in to flag this as inappropriate. |