Use GetMaintenanceWindowExecutionTask with an Amazon SDK or CLI - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use GetMaintenanceWindowExecutionTask with an Amazon SDK or CLI

The following code examples show how to use GetMaintenanceWindowExecutionTask.

CLI
Amazon CLI

To get information about a maintenance window task execution

The following get-maintenance-window-execution-task example lists information about a task that is part of the specified maintenance window execution.

aws ssm get-maintenance-window-execution-task \ --window-execution-id "518d5565-5969-4cca-8f0e-da3b2EXAMPLE" \ --task-id "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE"

Output:

{ "WindowExecutionId": "518d5565-5969-4cca-8f0e-da3b2EXAMPLE", "TaskExecutionId": "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE", "TaskArn": "AWS-RunPatchBaseline", "ServiceRole": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "Type": "RUN_COMMAND", "TaskParameters": [ { "BaselineOverride": { "Values": [ "" ] }, "InstallOverrideList": { "Values": [ "" ] }, "Operation": { "Values": [ "Scan" ] }, "RebootOption": { "Values": [ "RebootIfNeeded" ] }, "SnapshotId": { "Values": [ "{{ aws:ORCHESTRATION_ID }}" ] }, "aws:InstanceId": { "Values": [ "i-02573cafcfEXAMPLE", "i-0471e04240EXAMPLE", "i-07782c72faEXAMPLE" ] } } ], "Priority": 1, "MaxConcurrency": "1", "MaxErrors": "3", "Status": "SUCCESS", "StartTime": "2021-08-04T11:45:35.088000-07:00", "EndTime": "2021-08-04T11:53:09.079000-07:00" }

For more information, see View information about tasks and task executions (Amazon CLI) in the Amazon Systems Manager User Guide.

PowerShell
Tools for PowerShell

Example 1: This example lists information about a task that was part of a maintenance window execution.

Get-SSMMaintenanceWindowExecutionTask -TaskId "ac0c6ae1-daa3-4a89-832e-d384503b6586" -WindowExecutionId "518d5565-5969-4cca-8f0e-da3b2a638355"

Output:

EndTime : 2/21/2017 4:00:35 PM MaxConcurrency : 1 MaxErrors : 1 Priority : 10 ServiceRole : arn:aws:iam::123456789012:role/MaintenanceWindowsRole StartTime : 2/21/2017 4:00:34 PM Status : FAILED StatusDetails : The maximum error count was exceeded. TaskArn : AWS-RunShellScript TaskExecutionId : ac0c6ae1-daa3-4a89-832e-d384503b6586 TaskParameters : {Amazon.Runtime.Internal.Util.AlwaysSendDictionary`2[System.String,Amazon.SimpleSystemsManagement.Model.MaintenanceWindowTaskPara meterValueExpression]} Type : RUN_COMMAND WindowExecutionId : 518d5565-5969-4cca-8f0e-da3b2a638355

For a complete list of Amazon SDK developer guides and code examples, see Using Systems Manager with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.