This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Uploading a single file to an S3 Bucket using PowerShell. | |
| # AWS accessKey and secretKey can be removed below and from Write-S3Object if running on an EC2 instance and using IAM roles for security. | |
| $accessKey = "Access Key Here" | |
| $secretKey = "Secret Key Here" | |
| # I broke it out like this to make it more modular, but you could just add this information directly to the write-S3object cmdlet if you wanted to make | |
| # a one liner to do this. | |
| #This section is setting up the variables for the local file you want to move to S3. | |
| $filepath = "c:\temp\backupFiles" #This is the path where the file you want to move from Windows machine to S3 resides. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Download a single file from an S3 bucket to your local computer. | |
| # AWS accessKey and secretKey can be removed below and from Copy-S3Object if running on an EC2 instance and using IAM roles for security. | |
| $accessKey = "Access Key Here" | |
| $secretKey = "Secret Key Here" | |
| # I broke it out like this to make it more modular, but you could just add this information directly to the Copy-S3object cmdlet if you wanted to make | |
| # a one liner to do this. | |
| #This section is setting up the variables for the local file you want to move the S3 file to. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Backup-my-installed-posh-modules.ps1 | |
| # Use this to backup your installed PowerShell Modules to a PS1 file so you can re-install onto another computer. | |
| ##Check if c:\scripts\powershell\backups exists, if it doesnt create it. | |
| $foldertest = "c:\scripts\powershell\backups" | |
| If (-not(Test-Path -Path $foldertest)) | |
| { New-Item -ItemType Directory -Force -Path $foldertest } | |
| #Pull installed modules and join them in a single line comma seperated. | |
| $Modules_Installed = (Get-InstalledModule | sort name).name -join "," | |
| #Build the install Module Powershell line. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # membership_of_AWS_IAM_Groups.ps1 | |
| <# | |
| Description: This will show the membership of IAM Users in a list of AWS IAM Groups. | |
| For Password_LastUsed, if the account does not have a password, which means no access to AWS Console, or if the password was never used, it outputs "1/1/0001 12:00:00 AM", I capture this and replace with a blank. | |
| Written: Ed Walsh | |
| PowerShell.Core tested: Not Tested | |
| Version: 1.0.0 | |
| Create Date: 11/3/2021 | |
| Revised Date: 11/3/2021 | |
| #> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # active_aws_access_keys_Details.ps1 | |
| <# | |
| Description: Pulls user IAM accounts ACTIVE Access keys that are older than a set number of days since used and Create Days is older than a set amount. And gets the Access Keys details. This will skip Disabled Keys. | |
| Can be used to find keys older than a set amount of days and not used in a set amount of days so they can be disabled. | |
| Written: Ed Walsh | |
| PowerShell.Core tested: Not Tested | |
| Version: 1.0.2 | |
| Create Date: 11/5/2021 | |
| Revised Date: 11/7/2021 | |
| #> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ec2-snapshots-inventory.ps1 | |
| <# | |
| Description: This will pull an inventory of all snapshots for all EBS volumes attached to an EC2 Instance | |
| original from: https://matthewdavis111.com/powershell/ec2-latest-snapshots-of-attached-volumes/ | |
| Altered original script to fit my needs. | |
| Written by: Matthew Davis - see link above to original script. | |
| Modified by: Ed Walsh | |
| PowerShell.Core tested: Not Tested | |
| Version: 1.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ec2-cpu-utilization-report.ps1 | |
| <# | |
| Description: This will pull from a date range, the AVG CPU utilization for an EC2 Instance, and save to a CSV file. | |
| Written: Ed Walsh | |
| PowerShell.Core tested: Not Tested | |
| Version: 1.0.0 | |
| Create Date: 12/2/2021 | |
| Revised Date: 12/2/2021 | |
| #> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get-password.ps1 | |
| <# | |
| Description: A Function used to make a password, Can set length and Complexity of password. | |
| Written: Ed Walsh | |
| PowerShell.Core tested: Not Tested | |
| Version: 1.0.0 | |
| Create Date: 12/15/2021 | |
| Revised Date: 12/15/2021 | |
| #> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #set-ec2-tag-all-running-windows-instances.ps1 | |
| <# | |
| Description: Set Tag and Value to all running Windows EC2 | |
| Written: Ed Walsh | |
| PowerShell.Core tested: Yes | |
| Version: 1.0.0 | |
| Create Date: 1/10/2022 | |
| Revised Date: 1/10/2022 | |
| #> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Check-for-available-AWS-ENI.ps1 | |
| <# | |
| Scan Each Region, Each VPC, Each Subnet for Available ENI and count the IP's associated to the ENI. Use it to clean up un-used ENI and regain those Private IP's | |
| #> | |
| (Get-EC2Region).regionname | foreach { (Get-EC2Vpc -Region $_).vpcid | foreach { Get-EC2Subnet -Filter @{Name="vpc-id";Value="$_"} | foreach { Get-EC2NetworkInterface -Filter @(@{Name="subnet-id";Values=$_.subnetid} ; @{Name="status";Values="available"} ) | Select-Object VPCID, InterfaceType, NetworkInterfaceID, @{n="PrivateIP-Count"; e= {($_.privateipaddresses | Measure-Object).count}}, SubnetID, Status } } } | Format-Table -AutoSize |