By using AWS re:Post, you agree to the Terms of Use
/AWS Tools for Windows PowerShell/

Questions tagged with AWS Tools for Windows PowerShell

Sort by most recent
  • 1
  • 90 / page

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

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
4
views
asked a day 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
18
views
asked 3 days ago

Can I use Get-EC2Tag or Get-EC2Instance AWSPowershell cmdlets to match multiple tags and return results only matching those two tags?

I want to return the resource/instance ID of a specific instance matching two tags: `$awsEx = (Get-EC2Tag -Filter @{name='tag:Status';values=""},@{name='tag:Site';values="SITENAME"}).ResourceId` `$awsEx` returns nothing. Running this: `$awsExIpv4 = (Get-EC2Instance -InstanceId $awsEx).Instances.PrivateIpAddress` `$awsExIpv4 `returns a list of instance IP addresses. The IPs I've crosschecked have matched the Site value. So it's simply returning instances that only match the Site tag and not the Status tag. If it did match both tags, it would return only one instance. The instance that contains no value in Status tag *and* is tagged with SITENAME in the Site tag. When I run: `$awsEx = (Get-EC2Tag -Filter @{name='tag:Status';values=""}).ResourceId` `$awsEx` returns the instance Id I need. **How do I run this query to return results only matching both tags? ** While this works now to return only the instance I need, in the future there could be other instances with no value in the Status tag but differing values in the site tag that should not be returned, as the returned instance Id in the script I am running will be terminated. **RESOLUTION** I was able to resolve this by using different appends and the correct cmdlet. Please see below: `$awsEx = (Get-EC2Instance -Filter @{name='tag:Status';values=""},@{name='tag:Site';values="SITENAME"}).Instances.InstanceId `
1
answers
0
votes
30
views
asked 8 days ago

How to change default Windows resolution? (Autologon resolution without active rdp session, e.g. for UI test automation with selenium)

Hello, I search for a solution on AWS EC2 Windows Instance to change the **default resolution**, to have a specific resolution, even if **no **active RDP session is connected. For Autologin after instance is started, I use official MS Sysintenals Autologon: https://docs.microsoft.com/en-us/sysinternals/downloads/autologon Everything is working fine with Autologon without RDP. I can simply reboot the instance or start new instanced, Autologon is happening, and also scripts (and UI test automation) is starting and running fine. But changing resolution of apps, e.g. the browser, is not working, this seems to be related to windows resolution itself. Because when I connect with RDP to the machine, all changes to app/browser windows sizes are working fine, with exactly the same scripts. But without an active RDP session, just with Autologon after reboot, resolution changes on app/browser are not done, this seems to be related because Windows resolution is too small without active RDP session. I found a lot of topics and tried all solutions: This one: https://superuser.com/questions/853252/how-to-change-the-default-resolution-in-windows-for-automatic-logon. Or using PowerShell command itself, e.g.: “Set-DisplayResolution -Width 1920 -Height 1080 -Force” But now one fix the problem. Someone have a solution to set a specific windows resolution for a session with**out **active RDP connection (e.g. session per Autologon)? Thanks a lot
0
answers
0
votes
3
views
asked 3 months ago
  • 1
  • 90 / page