Redfish API (Dell) job creation failing

45 views Asked by At

I wrote a script to make some changes in the BIOS settings on DELL PowerEdge servers. The script works as intended up to this point, meaning I can see that the changes are pending. The challenge here is that a job needs to be created for these changes to be either applied immediately (with a server reboot) or applied at the next reboot.

The WebGUI features three buttons: "Apply and Reboot," "Apply at next reboot," and "Discard all pending." Without pressing one of these buttons, even if the server is rebooted, the changes will still appear as pending.

I've tried a few API endpoints, but I can't seem to figure out how to create these jobs.

Pending change

3 buttons

here are the endpoits I tried:

 # iDRAC API URI for BIOS settings
    $biosUri = "https://$idracIp/redfish/v1/Systems/System.Embedded.1/Bios/Settings"
    # iDRAC API URI for creating a job
    $jobServiceUri = "https://$idracIp/redfish/v1/JobService"

    # Apply BIOS settings
    try {
        Invoke-RestMethod -Uri $biosUri -Method Patch -Headers @{Authorization=("Basic {0}" -f $encodedCredentials)} -Body $jsonBiosSettings -ContentType "application/json"
        Write-Host "BIOS settings updated successfully for iDRAC at $idracIp."

        # Create job for BIOS settings
        $jobBody = @{
            TargetSettingsURI = "/redfish/v1/Systems/System.Embedded.1/Bios/Settings"
            ScheduledStartTime = "TIME_NOW"
        } | ConvertTo-Json
# iDRAC API URI for creating a job
    $jobServiceUri = "https://$idracIp/redfish/v1/Managers/System.Embedded.1/Oem/Dell/DellJobService/Actions/DellJobService.SetupJobQueue"
$jobUri = "https://$idracIp/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
1

There are 1 answers

0
Angry Admin On

Ok, I figured it out.

To schedule a job but not reboot, one needs to drop this line

ScheduledStartTime = "TIME_NOW"

Works as a charm.