Exercise 6 - Deploy All Missing Patches
Goal
Deploy all patches that were identified as missing in the patch scan performed in Exercise 3.
Requirements
You will need to know the ID of the patch scan and the ID of the patch deployment template you want to use when performing the deployment.
- Establish a session credential (see Session Credentials)
- To determine the patch scan ID, look in the output from Exercise 3
- To determine the IDs of the available patch deployment templates, perform the following GET request:
In the sample output in Exercise 3, the patch scan ID is 8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a.
https://localhost:3121/st/console/api/v1.0/patch/deploytemplates
Try it yourself
Perform a deployment of all missing patches identified during a patch scan by submitting a POST request similar to the following:
Change the scanId and templateId values as needed.
Postman Example
https://localhost:3121/st/console/api/v1.0/patch/deployments { "scanId":"8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a", "templateId":"7b5bc7e4-7437-47ac-ae2e-569ffdb0ccf8" }
PowerShell script example
$scanId = "8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a" $patchDeployTemplateId = "4c7069eb-6e1c-4352-91fc-04d4d8abc07b" $patchDeployUrl = "https://localhost:3121/st/console/api/v1.0/patch/deployments" $patchDeployBody = @{ ScanId = $scanId; TemplateId = $patchDeployTemplateId; } | ConvertTo-Json -Depth 99 $deploy = Invoke-WebRequest -Method Post -Credential $credential -Uri $patchDeployUrl -Body $patchDeployBody -ContentType "application/json" | ConvertTo-Json -Depth 99
Output
The result is a JSON-formatted response similar to the following:
StatusCode:
202
Content:
null
Headers:
{ [Operation-Location, https://device-name.example.com:3121/st/console/api/v1.0/operations/ac0edcc9-0780-479c-a95e-f76f9fea80a4], [Content-Length, 4], [Content-Type, application/json; charset=utf-8], [Date, Mon, 29 Apr 2019 19:43:55 GMT] }