aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
238 stars 79 forks source link

Register-SSMTaskWithMaintenanceWindow Cmdlet Parameterdefinition #12

Closed magrossm closed 5 years ago

magrossm commented 5 years ago

I have following cmd.

$parameters = @{}
  $parameterValues = New-Object Amazon.SimpleSystemsManagement.Model.MaintenanceWindowTaskParameterValueExpression
  $parameterValues.Values = @("Test")
  $parameters.Add("Commands", $parameterValues)
  .......
  $newtask = Register-SSMTaskWithMaintenanceWindow -Windowid $newmw -ServiceRoleArn "arn:aws:iam::xxxxxxx" -MaxConcurrency 1 -MaxError 1 -TaskArn "AWS-RunPowerShellScript" -Target @{ Key="WindowTargetIds";Values="$newtarget"} -TaskType "RUN_COMMAND" -Priority 10 -TaskParameter $parameters

The not mentioned variables are defined and the registering of the task and etc. works but the parameters for the Run-Powershellscript CMD are not passed on. Does the Command Parameter have to have a special formatting to be included? (it either has to be the PS code itself or the location of the ps1)

Thx for any help.

magrossm commented 5 years ago

I solved it.

The API Documentation lacks the option -TaskInvocationParameters_RunCommand_Parameters for the Cmdlet. It is found in other API Cmdlets for Powershell (Lambda etc) and it works with this.

Please update the doc and close.

matteo-prosperi commented 5 years ago

Hello. The parameter is listed in the documentation as RunCommand_Parameter. TaskInvocationParameters_RunCommand_Parameters is an alias. I can look into improving the documentation by listing the parameter aliases.

matteo-prosperi commented 5 years ago

Hello. Thank you for opening this issue. We have added the list of aliases to the documentation (see https://docs.aws.amazon.com/powershell/latest/reference/items/Register-SSMTaskWithMaintenanceWindow.html).