Release Notes

21 Automating Dell EMC PowerEdge Server Management by using iDRAC REST API with DMTF Redfish and Microsoft PowerShell
}
if ($get_power_state_only -eq "n")
{
return
}
# POST command to set the new server power state. For POST commands, you must
create a hash table which must be converted to JSON format and compressed. This
behavior must be duplicated for all POST commands when creating the hash table.
$JsonBody = @{ "ResetType" = $power_request_value
} | ConvertTo-Json -Compress
# Create the URI and POST command to change the server power state.
$u4 =
"https://$idrac_ip/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Re
set"
$result1 = Invoke-WebRequest -Uri $u4 -Credential $credential -Method Post -Body
$JsonBody -ContentType 'application/json'
# Check if the POST command returned the correct status code
if ($result1.StatusCode -eq 204)
{
Write-Host
[String]::Format("- PASS, statuscode {0} returned, power control operation
success for: {1}",$result1.StatusCode, $power_request_value)
Start-Sleep 3
}
else
{
[String]::Format("- FAIL, statuscode {0} returned",$result1.StatusCode)
return
}
return
}