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

Invokes the RegisterTaskWithMaintenanceWindow operation against Amazon Simple Systems Management.

Syntax

Register-SSMTaskWithMaintenanceWindow
-TaskArn <String>
-Lambda_ClientContext <String>
-ClientToken <String>
-RunCommand_Comment <String>
-Description <String>
-RunCommand_DocumentHash <String>
-RunCommand_DocumentHashType <DocumentHashType>
-Automation_DocumentVersion <String>
-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>
-Force <SwitchParameter>

Description

Adds a new task to a Maintenance Window.

Parameters

-Automation_DocumentVersion <String>
The version of an SSM Automation document to use during task execution.
Required?False
Position?Named
Accept pipeline input?False
-Automation_Parameter <Hashtable>
Parameters for the AUTOMATION task.
Required?False
Position?Named
Accept pipeline input?False
-ClientToken <String>
User-provided idempotency token.
Required?False
Position?Named
Accept pipeline input?False
-Description <String>
An optional description for the task.
Required?False
Position?Named
Accept pipeline input?False
-Force <SwitchParameter>
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?False
-Lambda_ClientContext <String>
Using the ClientContext you can pass client-specific information to the Lambda function 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?False
-Lambda_Payload <Byte[]>
JSON that you want to provide to your Lambda function as input.
Required?False
Position?Named
Accept pipeline input?False
-Lambda_Qualifier <String>
You can use this optional parameter to specify a Lambda function version or alias name. If you specify a function version, the API uses the qualified function ARN to invoke a specific Lambda function. If you specify an alias name, the API uses the alias ARN to invoke the Lambda function version to which the alias points.
Required?False
Position?Named
Accept pipeline input?False
-LoggingInfo_S3BucketName <String>
The name of an Amazon S3 bucket where execution logs are stored .
Required?False
Position?Named
Accept pipeline input?False
-LoggingInfo_S3KeyPrefix <String>
(Optional) The Amazon S3 bucket subfolder.
Required?False
Position?Named
Accept pipeline input?False
-LoggingInfo_S3Region <String>
The region where the Amazon S3 bucket is located.
Required?False
Position?Named
Accept pipeline input?False
-MaxConcurrency <String>
The maximum number of targets this task can be run for in parallel.
Required?False
Position?Named
Accept pipeline input?False
-MaxError <String>
The maximum number of errors allowed before this task stops being scheduled.
Required?False
Position?Named
Accept pipeline input?False
-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 a Simple Notification Service (SNS) topic. Run Command pushes notifications about command status changes to this topic.
Required?False
Position?Named
Accept pipeline input?False
-NotificationConfig_NotificationEvent <String[]>
The different events for which you can receive notifications. These events include the following: All (events), InProgress, Success, TimedOut, Cancelled, Failed. To learn more about these events, see Setting Up Events and Notifications in the Amazon EC2 Systems Manager User Guide.
Required?False
Position?Named
Accept pipeline input?False
-NotificationConfig_NotificationType <NotificationType>
Command: Receive notification when the status of a command changes. Invocation: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes.
Required?False
Position?Named
Accept pipeline input?False
-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?False
-RunCommand_Comment <String>
Information about the command(s) to execute.
Required?False
Position?Named
Accept pipeline input?False
-RunCommand_DocumentHash <String>
The Sha256 or Sha1 hash created by the system when the document was created. Sha1 hashes have been deprecated.
Required?False
Position?Named
Accept pipeline input?False
-RunCommand_DocumentHashType <DocumentHashType>
Sha256 or Sha1. Sha1 hashes have been deprecated.
Required?False
Position?Named
Accept pipeline input?False
-RunCommand_OutputS3BucketName <String>
The name of the Amazon S3 bucket.
Required?False
Position?Named
Accept pipeline input?False
-RunCommand_OutputS3KeyPrefix <String>
The Amazon S3 bucket subfolder.
Required?False
Position?Named
Accept pipeline input?False
-RunCommand_Parameter <Hashtable>
Parameters for the RUN_COMMAND task execution.
Required?False
Position?Named
Accept pipeline input?False
-RunCommand_ServiceRoleArn <String>
The IAM service role that to assume during task execution.
Required?False
Position?Named
Accept pipeline input?False
-RunCommand_TimeoutSecond <Int32>
If this time is reached and the command has not already started executing, it will not execute.
Required?False
Position?Named
Accept pipeline input?False
-ServiceRoleArn <String>
The role that should be assumed when executing the task.
Required?False
Position?Named
Accept pipeline input?False
-StepFunctions_Input <String>
The inputs for the STEP_FUNCTION task.
Required?False
Position?Named
Accept pipeline input?False
-StepFunctions_Name <String>
The name of the STEP_FUNCTION task.
Required?False
Position?Named
Accept pipeline input?False
-Target <Target[]>
The targets (either instances or tags). Instances are specified using Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag name>,Values=<tag value>.
Required?False
Position?Named
Accept pipeline input?False
-TaskArn <String>
The ARN of the task to execute
Required?False
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
-TaskParameter <Hashtable>
The parameters that should be passed to the task when it is executed.
Required?False
Position?Named
Accept pipeline input?False
The type of task being registered.
Required?False
Position?Named
Accept pipeline input?False
-WindowId <String>
The id of the Maintenance Window the task should be added to.
Required?False
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? False
-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? False
-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. Note that the encrypted credential file is not supported on all platforms. It will be skipped when searching for profiles on Windows Nano Server, Mac, and Linux platforms.

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? False
-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? False
-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? False
-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? False
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
-Region <String>
The system name of the AWS region in which the operation should be invoked. For example, us-east-1, eu-west-1 etc.
Required? False
Position? Named
Accept pipeline input? False
-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? False

Inputs

You can pipe a String object to this cmdlet for the TaskArn parameter.

Outputs

This cmdlet returns a 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

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

PS C:\> 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

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

PS C:\> 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.

Supported Version

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