I am trying to execute a PowerShell Script on a Windows EC2 Instance. The Powershell Script works (I RDP'd and executed it) but when I try to execute it using Boto3 SSM, it does not allow me to execute it with a parameter.
I am fairly positive this is a simple lack of clarity in the documentation or I am just making a fairly dumb mistake.
I have executed other Powershell scripts into the target instance but it seems like I can't get a powershell script that requires a parameter to work.
My Powershell script starts with:
param(
[string]$roleToRegister
)
and in my Lambda I call it using:
result = ssm.send_command(DocumentName="registerxx", InstanceIds=instances,
Parameters={'roleToRegister': ['myRole'] })
Currently I am receiving:
"An error occurred (InvalidParameters) when calling the SendCommand operation:
I have also tried defining the parameters dict as :
{
'$roleToRegister' : ['myRole']
}
Any ideas would be great. Thank you.
Link to documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.send_command