Unsolved
3 Posts
0
7463
Powershell REST API Script for updating firmware
With OME 3.0 we created a firmware baseline and did a successful firmware update for several M620/630 Blade servers. Cause we are running nearly 200 servers I´m looking for a Powershell Rest API script for starting this update job. Any idea about the syntax error in the script?
Error message:
Invoke-WebRequest : {"error":{"code":"Base.1.0.GeneralError","message":"A general error has occurred. See ExtendedInfo for more information.","@Message.ExtendedInfo":[{"MessageId":"CJOB4035","MessageId":"CJOB4035","RelatedProperties":[],"Message":"Unable to create or update the
job.","MessageArgs":[],"Severity":"Warning","Resolution":"Make sure the request payload is valid and that the current user has sufficient permissions and retry the operation."}]}}
# Variables for Dell EMC OpenManage Enterprise
$user = "admin"
$password = "*******"
$server = "xxxxxxx.com"
# | Credentials
$pass = $password
$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($user, $secpasswd)
# | Ignore SSL Certificate
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3, [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12
# | API Request
$u = "https://$server/api/JobService/Jobs"
$JsonBody = '{
"Id": 0,
"JobName": "Blink LED",
"JobDescription": "Blink LED: Turn On",
"Schedule": "startnow",
"State": "Enabled",
"JobType": {
"Id": 3,
"Name": "DeviceAction_Task"
},
"Targets": [
{
"Id": 25064,
"Data": "",
"TargetType": {
"Id": 1000,
"Name": "DEVICE"
}
}
]
}'
$result = Invoke-WebRequest -Uri $u -Credential $credential -Method Post -Body $JsonBody -ContentType 'application/json'
pdpelsem
18 Posts
0
December 28th, 2018 04:00
For me it works if I use basic authentication:
Hendrik2018
3 Posts
0
December 28th, 2018 04:00
I tested the general process for Powershell REST-API request with a Blink-LED Job in the script example below.
Hendrik2018
3 Posts
0
December 28th, 2018 05:00
Thanks for your reply!
I will check and test your suggestion next week at Wednesday and update the discussion afterwards.
pdpelsem
18 Posts
0
January 4th, 2019 02:00
@Anonymous
Is it possible to do Firmware Upgrades via the REST api?
I can't find any examples in the RESt api guide.
pdpelsem
18 Posts
0
January 15th, 2019 06:00
@Anonymous ,
any update on how to do firmware updates via the rest API?
DELL-Pupul M
1K Posts
1
January 16th, 2019 08:00
Hey,
There are a bunch of commands that are required to perform update using REST API. I am collating all of them in a place for you, I shall be posting it up soon.
keiran.steele
8 Posts
1
January 21st, 2019 18:00
Try this:
Simply POST this in the body to https:// /api/JobService/Jobs. I have been testing using the RESTED extension to Firefox.
Note that you need a few ids/bits of data to make it work:
If POST {"Ids":["123456"]} to /api/UpdateService/Actions/UpdateService.GetBaselinesReportByDeviceids then it will return a list of components that need updating and give you the complianceReportId, repositoryId and catalogId
qdellforum
33 Posts
1
April 24th, 2019 11:00
Did these ever get collected and posted? Would be super helpful!