By using AWS re:Post, you agree to the Terms of Use

Questions tagged with AWS Tools for Windows PowerShell

Sort by most recent
  • 1
  • 2
  • 12 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

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

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.
2
answers
0
votes
57
views
asked 3 months ago

How can we run Signed Powershell SSM Documents when ExecutionPolicy is set to AllSigned

Hi I've currently experiencing a bit of a road block with using SSM Documents using powershell. - We Define the policy though a GPO on the user/computer level - We have a CA which we use for Code Signing, we sign our Powershell scripts before they are allowed to run. - The Publisher code signing cert has been trusted. When I've tried to create a Powershell document using AWS SSM Document Manager - I have included the signature block in JSON which will end up as a file in **C:\ProgramData\Amazon\SSM\InstanceData\i-xyzxyzxyzxyz\document\orchestration\{run-command-id}\StepName\_script.ps1** I then get a message that the Run-Command has failed with the message **_script.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies** I've manually confirmed this file is identical to the script I initially wrote (before it became JSON and then a PS1 script) And I have diffed the two files. **Diff claims the files are identical (!)** But I still can't run it without getting that message. I've also tried running from an S3 bucket, but a _script file is still generated -- which in that case would not be signed. It seems the only way I'm able to run Signed powershell scripts at the moment is by running them on the system in a remote desktop session and using a locally saved version. Has anyone ever tried to accomplish this? Any success? I can't run any existing AWS Documents without signing them either ~
1
answers
0
votes
46
views
asked 3 months ago

powershell cloudtrail trying to get instance id from requestparameters

I am trying to pull instance Id and other parameters from cloudtrail using ps like so $results = Find-CTEvent -StartTime (Get-Date).AddMinutes(-30) | ? {$_.EventName -eq "TerminateInstances"} ` {"eventVersion":"1.08","userIdentity":{"type":"IAMUser","principalId":"xx","arn":"arn:aws:iam::462518063128:user/awslab1","accountId":"xxx","acces sKeyId":"xx","userName":"awslab1","sessionContext":{"sessionIssuer":{ },"webIdFederationData":{},"attributes":{"creationDate":"2022-05-27T14:28:44Z","mfaAuth enticated":"false"}}},"eventTime":"2022-05-27T17:04:12Z","eventSource":"ec2.amazonaws.c om","eventName":"TerminateInstances","awsRegion":"us-west-1","sourceIPAddress":"AWS Internal","userAgent":"AWS Internal","requestParameters":{"instancesSet":{"items":[{"in stanceId":"i-07efe3d31ef2cef02"}]}},"responseElements":{"requestId":"dde64a51-2fd6-40ef -b9d6-06fde8a2abd9","instancesSet":{"items":[{"instanceId":"i-07efe3d31ef2cef02","curre ntState":{"code":32,"name":"shutting-down"},"previousState":{"code":16,"name":"running" }}]}},"requestID":"dde64a51-2fd6-40ef-b9d6-06fde8a2abd9","eventID":"dfc1fa38-c5db-401d- 9ac9-11cd5ab41dd8","readOnly":false,"eventType":"AwsApiCall","managementEvent":true,"re cipientAccountId":"462518063038","eventCategory":"Management","sessionCredentialFromCon sole":"true"} ` then convertfrom json $results.CloudTrailEvent | ConvertFrom-Json eventVersion : 1.08 userIdentity : @{type=IAMUser; principalId=xxxx; arn=arn:aws:iam::462518063128user/awslab1; accountId=xx; accessKeyId=xxxx; userName=awslab1; sessionContext=} eventTime : 5/27/2022 5:04:12 PM eventSource : ec2.amazonaws.com eventName : TerminateInstances awsRegion : us-west-1 sourceIPAddress : AWS Internal userAgent : AWS Internal requestParameters : @{instancesSet=} responseElements : @{requestId=dde64a51-2fd6-40ef-b9d6-06fde8a2abd9; instancesSet=} requestID : dde64a51-2fd6-40ef-b9d6-06fde8a2abd9 eventID : dfc1fa38-c5db-401d-9ac9-11cd5ab41dd8 readOnly : False eventType : AwsApiCall managementEvent : True recipientAccountId : 462518061234 eventCategory : Management sessionCredentialFromConsole : true But the requestParameters : @{instancesSet=} is missing instance id and other values any idea?
0
answers
0
votes
24
views
asked 4 months ago

Install-AWSToolsModule AWS.Tools.EC2 issue

Hi, I try Install-AWSToolsModule AWS.Tools.EC2 has issue. I have rebuild OS but cant solved " PS C:\Windows\System32> Install-Module -Name AWS.Tools.Installer PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp Confirm Are you sure you want to perform this action? Performing the operation "Install-AWSToolsModule" on target "AWS Tools version 4.1.92.0". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\eihkbeqr.cf4\AWS.Tools.EC2.4.1.92.0.nupkg'." PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 Confirm Are you sure you want to perform this action? Performing the operation "Install-AWSToolsModule" on target "AWS Tools version 4.1.92.0". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): A Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\de4ooqxp.evb\AWS.Tools.EC2.4.1.92.0.nupkg'." PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -Force Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\yetrrcal.skx\AWS.Tools.EC2.4.1.92.0.nupkg'." PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.S3 -Force Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\zcwvmega.5ek\AWS.Tools.EC2.4.1.92.0.nupkg'." PS C:\Windows\System32> "
1
answers
0
votes
59
views
asked 4 months ago
  • 1
  • 2
  • 12 / page