AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Calls the AWS Systems Manager RegisterTaskWithMaintenanceWindow API operation.

Syntax

Register-SSMTaskWithMaintenanceWindow
-TaskArn <String>
-AlarmConfiguration_Alarm <Alarm[]>
-Lambda_ClientContext <String>
-CloudWatchOutputConfig_CloudWatchLogGroupName <String>
-CloudWatchOutputConfig_CloudWatchOutputEnabled <Boolean>
-RunCommand_Comment <String>
-CutoffBehavior <MaintenanceWindowTaskCutoffBehavior>
-Description <String>
-RunCommand_DocumentHash <String>
-RunCommand_DocumentHashType <DocumentHashType>
-Automation_DocumentVersion <String>
-RunCommand_DocumentVersion <String>
-AlarmConfiguration_IgnorePollAlarmFailure <Boolean>
-StepFunctions_Input <String>
-MaxConcurrency <String>
-MaxError <String>
-Name <String>
-StepFunctions_Name <String>
-NotificationConfig_NotificationArn <String>
-NotificationConfig_NotificationEvent <String[]>
-NotificationConfig_NotificationType <NotificationType>
-RunCommand_OutputS3BucketName <String>
-RunCommand_OutputS3KeyPrefix <String>
-Automation_Parameter <Hashtable>
-RunCommand_Parameter <Hashtable>
-Lambda_Payload <Byte[]>
-Priority <Int32>
-Lambda_Qualifier <String>
-LoggingInfo_S3BucketName <String>
-LoggingInfo_S3KeyPrefix <String>
-LoggingInfo_S3Region <String>
-ServiceRoleArn <String>
-RunCommand_ServiceRoleArn <String>
-Target <Target[]>
-TaskParameter <Hashtable>
-TaskType <MaintenanceWindowTaskType>
-RunCommand_TimeoutSecond <Int32>
-WindowId <String>
-ClientToken <String>
-Select <String>
-PassThru <SwitchParameter>
-Force <SwitchParameter>
-ClientConfig <AmazonSimpleSystemsManagementConfig>

Description

Adds a new task to a maintenance window.

Parameters

-AlarmConfiguration_Alarm <Alarm[]>
The name of the CloudWatch alarm specified in the configuration.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAlarmConfiguration_Alarms
-AlarmConfiguration_IgnorePollAlarmFailure <Boolean>
When this value is true, your automation or command continues to run in cases where we can’t retrieve alarm status information from CloudWatch. In cases where we successfully retrieve an alarm status of OK or INSUFFICIENT_DATA, the automation or command continues to run, regardless of this value. Default is false.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Automation_DocumentVersion <String>
The version of an Automation runbook to use during task execution.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_Automation_DocumentVersion
-Automation_Parameter <Hashtable>
The parameters for the AUTOMATION task.For information about specifying and updating task parameters, see RegisterTaskWithMaintenanceWindow and UpdateMaintenanceWindowTask.LoggingInfo has been deprecated. To specify an Amazon Simple Storage Service (Amazon S3) bucket to contain logs, instead use the OutputS3BucketName and OutputS3KeyPrefix options in the TaskInvocationParameters structure. For information about how Amazon Web Services Systems Manager handles these options for the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters.TaskParameters has been deprecated. To specify parameters to pass to a task when it runs, instead use the Parameters option in the TaskInvocationParameters structure. For information about how Systems Manager handles these options for the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters.For AUTOMATION task types, Amazon Web Services Systems Manager ignores any values specified for these parameters.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_Automation_Parameters
Amazon.PowerShell.Cmdlets.SSM.AmazonSimpleSystemsManagementClientCmdlet.ClientConfig
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ClientToken <String>
User-provided idempotency token.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-CloudWatchOutputConfig_CloudWatchLogGroupName <String>
The name of the CloudWatch Logs log group where you want to send command output. If you don't specify a group name, Amazon Web Services Systems Manager automatically creates a log group for you. The log group uses the following naming format:aws/ssm/SystemsManagerDocumentName
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_CloudWatchOutputConfig_CloudWatchLogGroupName
-CloudWatchOutputConfig_CloudWatchOutputEnabled <Boolean>
Enables Systems Manager to send command output to CloudWatch Logs.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_CloudWatchOutputConfig_CloudWatchOutputEnabled
Indicates whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.
  • CONTINUE_TASK: When the cutoff time is reached, any tasks that are running continue. The default value.
  • CANCEL_TASK:
    • For Automation, Lambda, Step Functions tasks: When the cutoff time is reached, any task invocations that are already running continue, but no new task invocations are started.
    • For Run Command tasks: When the cutoff time is reached, the system sends a CancelCommand operation that attempts to cancel the command associated with the task. However, there is no guarantee that the command will be terminated and the underlying process stopped.
    The status for tasks that are not completed is TIMED_OUT.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Description <String>
An optional description for the task.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Lambda_ClientContext <String>
Pass client-specific information to the Lambda function that you are invoking. You can then process the client information in your Lambda function as you choose through the context variable.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_Lambda_ClientContext
-Lambda_Payload <Byte[]>
JSON to provide to your Lambda function as input.The cmdlet will automatically convert the supplied parameter of type string, string[], System.IO.FileInfo or System.IO.Stream to byte[] before supplying it to the service.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_Lambda_Payload
-Lambda_Qualifier <String>
(Optional) Specify an Lambda function version or alias name. If you specify a function version, the operation uses the qualified function Amazon Resource Name (ARN) to invoke a specific Lambda function. If you specify an alias name, the operation uses the alias ARN to invoke the Lambda function version to which the alias points.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_Lambda_Qualifier
-LoggingInfo_S3BucketName <String>
The name of an S3 bucket where execution logs are stored.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-LoggingInfo_S3KeyPrefix <String>
(Optional) The S3 bucket subfolder.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-LoggingInfo_S3Region <String>
The Amazon Web Services Region where the S3 bucket is located.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-MaxConcurrency <String>
The maximum number of targets this task can be run for, in parallel.Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a targetless task You must provide a value in all other cases.For maintenance window tasks without a target specified, you can't supply a value for this option. Instead, the system inserts a placeholder value of 1. This value doesn't affect the running of your task.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-MaxError <String>
The maximum number of errors allowed before this task stops being scheduled.Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a targetless task You must provide a value in all other cases.For maintenance window tasks without a target specified, you can't supply a value for this option. Instead, the system inserts a placeholder value of 1. This value doesn't affect the running of your task.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesMaxErrors
-Name <String>
An optional name for the task.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NotificationConfig_NotificationArn <String>
An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes notifications about command status changes to this topic.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_NotificationConfig_NotificationArn
-NotificationConfig_NotificationEvent <String[]>
The different events for which you can receive notifications. To learn more about these events, see Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_NotificationConfig_NotificationEvents
-NotificationConfig_NotificationType <NotificationType>
The type of notification.
  • Command: Receive notification when the status of a command changes.
  • Invocation: For commands sent to multiple managed nodes, receive notification on a per-node basis when the status of a command changes.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_NotificationConfig_NotificationType
-PassThru <SwitchParameter>
Changes the cmdlet behavior to return the value passed to the TaskArn parameter. The -PassThru parameter is deprecated, use -Select '^TaskArn' instead. This parameter will be removed in a future version.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Priority <Int32>
The priority of the task in the maintenance window, the lower the number the higher the priority. Tasks in a maintenance window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-RunCommand_Comment <String>
Information about the commands to run.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_Comment
-RunCommand_DocumentHash <String>
The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been deprecated.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_DocumentHash
-RunCommand_DocumentHashType <DocumentHashType>
SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_DocumentHashType
-RunCommand_DocumentVersion <String>
The Amazon Web Services Systems Manager document (SSM document) version to use in the request. You can specify $DEFAULT, $LATEST, or a specific version number. If you run commands by using the Amazon Web Services CLI, then you must escape the first two options by using a backslash. If you specify a version number, then you don't need to use the backslash. For example:--document-version "\$DEFAULT"--document-version "\$LATEST"--document-version "3"
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_DocumentVersion
-RunCommand_OutputS3BucketName <String>
The name of the Amazon Simple Storage Service (Amazon S3) bucket.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_OutputS3BucketName
-RunCommand_OutputS3KeyPrefix <String>
The S3 bucket subfolder.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_OutputS3KeyPrefix
-RunCommand_Parameter <Hashtable>
The parameters for the RUN_COMMAND task execution.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_Parameters
-RunCommand_ServiceRoleArn <String>
The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) service role to use to publish Amazon Simple Notification Service (Amazon SNS) notifications for maintenance window Run Command tasks.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_ServiceRoleArn
-RunCommand_TimeoutSecond <Int32>
If this time is reached and the command hasn't already started running, it doesn't run.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_RunCommand_TimeoutSeconds
-Select <String>
Use the -Select parameter to control the cmdlet output. The default value is 'WindowTaskId'. Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.SimpleSystemsManagement.Model.RegisterTaskWithMaintenanceWindowResponse). Specifying the name of a property of type Amazon.SimpleSystemsManagement.Model.RegisterTaskWithMaintenanceWindowResponse will result in that property being returned. Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ServiceRoleArn <String>
The Amazon Resource Name (ARN) of the IAM service role for Amazon Web Services Systems Manager to assume when running a maintenance window task. If you do not specify a service role ARN, Systems Manager uses your account's service-linked role. If no service-linked role for Systems Manager exists in your account, it is created when you run RegisterTaskWithMaintenanceWindow.For more information, see Using service-linked roles for Systems Manager in the in the Amazon Web Services Systems Manager User Guide:
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-StepFunctions_Input <String>
The inputs for the STEP_FUNCTIONS task.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_StepFunctions_Input
-StepFunctions_Name <String>
The name of the STEP_FUNCTIONS task.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskInvocationParameters_StepFunctions_Name
-Target <Target[]>
The targets (either managed nodes or maintenance window targets).One or more targets must be specified for maintenance window Run Command-type tasks. Depending on the task, targets are optional for other maintenance window task types (Automation, Lambda, and Step Functions). For more information about running tasks that don't specify targets, see Registering maintenance window tasks without targets in the Amazon Web Services Systems Manager User Guide.Specify managed nodes using the following format: Key=InstanceIds,Values=<instance-id-1>,<instance-id-2>Specify maintenance window targets using the following format:Key=WindowTargetIds,Values=<window-target-id-1>,<window-target-id-2>
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTargets
-TaskArn <String>
The ARN of the task to run.
Required?True
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
-TaskParameter <Hashtable>
The parameters that should be passed to the task when it is run.TaskParameters has been deprecated. To specify parameters to pass to a task when it runs, instead use the Parameters option in the TaskInvocationParameters structure. For information about how Systems Manager handles these options for the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTaskParameters
The type of task being registered.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
-WindowId <String>
The ID of the maintenance window the task should be added to.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAK
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-EndpointUrl <String>
The endpoint to make the call against.Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-ProfileLocation <String>
Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials.If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAWSProfilesLocation, ProfilesLocation
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesStoredCredentials, AWSProfileName
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRegionToCall
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSK, SecretAccessKey
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesST

Outputs

This cmdlet returns a System.String object. The service call response (type Amazon.SimpleSystemsManagement.Model.RegisterTaskWithMaintenanceWindowResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Examples

Example 1

$parameters = @{}
$parameterValues = New-Object Amazon.SimpleSystemsManagement.Model.MaintenanceWindowTaskParameterValueExpression
$parameterValues.Values = @("Install")
$parameters.Add("Operation", $parameterValues)

Register-SSMTaskWithMaintenanceWindow -WindowId "mw-03a342e62c96d31b0" -ServiceRoleArn "arn:aws:iam::123456789012:role/MaintenanceWindowsRole" -MaxConcurrency 1 -MaxError 1 -TaskArn "AWS-RunShellScript" -Target @{ Key="InstanceIds";Values="i-0000293ffd8c57862" } -TaskType "RUN_COMMAND" -Priority 10 -TaskParameter $parameters

f34a2c47-ddfd-4c85-a88d-72366b69af1b
This example registers a task with a maintenance window using an instance ID. The output is the Task ID.

Example 2

$parameters = @{}
$parameterValues = New-Object Amazon.SimpleSystemsManagement.Model.MaintenanceWindowTaskParameterValueExpression
$parameterValues.Values = @("Install")
$parameters.Add("Operation", $parameterValues)

register-ssmtaskwithmaintenancewindow -WindowId "mw-03a342e62c96d31b0" -ServiceRoleArn "arn:aws:iam::123456789012:role/MaintenanceWindowsRole" -MaxConcurrency 1 -MaxError 1 -TaskArn "AWS-RunShellScript" -Target @{ Key="WindowTargetIds";Values="350d44e6-28cc-44e2-951f-4b2c985838f6" } -TaskType "RUN_COMMAND" -Priority 10 -TaskParameter $parameters

f34a2c47-ddfd-4c85-a88d-72366b69af1b
This example registers a task with a maintenance window using a target ID. The output is the Task ID.

Example 3

$parameters = [Collections.Generic.Dictionary[String,Collections.Generic.List[String]]]::new()
$parameters.Add("commands",@("ipconfig","dir env:\computername"))
$parameters.Add("executionTimeout",@(3600))

$props = @{
WindowId = "mw-0123e4cce56ff78ae"
ServiceRoleArn = "arn:aws:iam::123456789012:role/MaintenanceWindowsRole"
MaxConcurrency = 1
MaxError = 1
TaskType = "RUN_COMMAND"
TaskArn = "AWS-RunPowerShellScript"
Target = @{Key="WindowTargetIds";Values="fe1234ea-56d7-890b-12f3-456b789bee0f"}
Priority = 1
RunCommand_Parameter = $parameters
Name = "set-via-cmdlet"
}

Register-SSMTaskWithMaintenanceWindow @props

f1e2ef34-5678-12e3-456a-12334c5c6cbe
This example creates a parameter object for the run command document AWS-RunPowerShellScript and creates a task with given maintenance window using target ID. The return output is the task ID.

Example 4

$automationParameters = @{}
$automationParameters.Add( "instanceId", @("{{ TARGET_ID }}") )
$automationParameters.Add( "AutomationAssumeRole", @("{arn:aws:iam::111111111111:role/AutomationRole}") )
$automationParameters.Add( "SnapshotTimeout", @("PT20M") )
Register-SSMTaskWithMaintenanceWindow -WindowId mw-123EXAMPLE456`
-ServiceRoleArn "arn:aws:iam::123456789012:role/MW-Role"`
-MaxConcurrency 1 -MaxError 1 -TaskArn "CreateVolumeSnapshots"`
-Target @{ Key="WindowTargetIds";Values="4b5acdf4-946c-4355-bd68-4329a43a5fd1" }`
-TaskType "AUTOMATION"`
-Priority 4`
-Automation_DocumentVersion '$DEFAULT' -Automation_Parameter $automationParameters -Name "Create-Snapshots"
This example registers an AWS Systems Manager Automation task by using a document named Create-Snapshots.

Supported Version

AWS Tools for PowerShell: 2.x.y.z