Send-SSMCommand 'AWS-ConfigureAWSPackage' -parameters @HashTableOfPackageNameActionInstallType errors that document does not support parameters

0

I am attempting to use PowerShell Tools (aws.tools) module version 4.1.42 and PowerShell core 7.2.5 to send a RunCommand to EC2 instance to install the AmazonCloudWatchAgent to an EC2 instance. The error is that 'Send-SSMCommand: document AWS-ConfigureAWSPackage does not support parameters'. It MUST support parameters or else how would the document know what package name/action/installType to install? Does this commandlet need to be updated? The document DOES accept parameters because this works in the awscli via aws ssm send-command --document-name 'AWS-ConfigureAWSPackage' --parameters '{action/packagename/installtype/etc}

So the document does accept parameters or else the awscli v PowerShell Tools passes the -parameters flag differently to the AWS cli.

The actual code I am running is below. (the parameter string is stolen directly from the SSM run command UI at the bottom of the runcommand page when you select your options so you can run it via aws cli, I just stole the parameter argument)

$params = '{"action":["uninstall"],"installatinType":[Uninstall and reinstall"],"version":[""],"additionalArguments":[""],"name":["AmazonCloudWatchAgent"]}' | convertfrom-json -ashashtable

Send-SSMCommand -DocumentName 'AWS-ConfigureAWSPackage' -InstanceID $ID -Parameter $params -region us-west-2

The error is not that the variable is improperly formed , rather that 'Send-SSMCommand: document AWS-ConfigureAWSPackage does not support parameters. ' I think it is a bug with the cmdlet? Can you try running it? I am guessing that the cmdlet needs updated and is not passsing the flags correctly to the aws api for the document., the awscli must be correctly passing them.

  • Could you please provide the exact code snippet you are using to call the commandlet? Sometimes this error message means there is just an issue with the provided parameters block itself, e.g. a typo or wrong formatting.

2 Answers
1

wow, the problem was that the "U" in Uninstall was not capitalized. I took the string directly from the console so either it provided the lowercase or I retyped Uninstall without the capital...sorry

answered 2 years ago
0

Hello,

Thank you so much for your rePost question, my name is RJ an engineer and I will be assisting with your inquiry today. From the provided snippet, it looks like the parameters for the document are being passed with PowerShell's splatting. However, the parameters parameter is expecting a datatype of <hashtable>.

Original:

Send-SSMCommand 'AWS-ConfigureAWSPackage' -parameters @HashTableOfPackageNameActionInstallType

Proposed:

Send-SSMCommand 'AWS-ConfigureAWSPackage' -parameters $HashTableOfPackageNameActionInstallType

References

AWS
SUPPORT ENGINEER
RJ-D
answered 2 years ago
  • RJ, thank you for the reply, I should have provided some more info, I have already cast the variable as a hashtable and am actually doing this:

    (the parameter string is stolen directly from the SSM run command UI at the bottom of the runcommand page when you select your options so you can run it via aws cli, I just stole the parameter argument)

    $params = '{"action":["uninstall"],"installatinType":[Uninstall and reinstall"],"version":[""],"additionalArguments":[""],"name":["AmazonCloudWatchAgent"]}' | convertfrom-json -ashashtable Send-SSMCommand -DocumentName 'AWS-ConfigureAWSPackage' -InstanceID $ID -Parameter $params -region us-west-2

    The error is not that the variable is improperly formed , rather that 'Send-SSMCommand: document AWS-ConfigureAWSPackage does not support parameters. ' I think it is a bug with the cmdlet? Can you try running it? I am guessing that the cmdlet needs updated and is not passsing the flags correctly to the aws api for the document., the awscli must be correctly passing them.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions