Skip to content

Instantly share code, notes, and snippets.

View Rugby-Ball's full-sized avatar

Ed Walsh Rugby-Ball

View GitHub Profile
@Rugby-Ball
Rugby-Ball / aws-ec2-snapshot-count-and-aged-out-with-cost.ps1
Last active February 6, 2024 22:35
Get the count of Snapshots for an AWS account across all AWS Regions, along with count over set days old, and what is oldest date of snapshot. calculate the cost per GB for old snapshots #Inventory #Utility #AWS #Public #Snapshots #EBS
# aws-ec2-snapshot-count-and-aged-out-with-cost.ps1
Import-Module AWSPowerShell.netcore
## Powershell.Core safe (PoSh 6+)
#Import-Module AWSPowerShell.NetCore
## Ed Walsh
## Date: 12/9/2020
## Modified: 02/06/2024
<# Get the count of Snapshots for an AWS account across all AWS Regions, along with count over set days old, and what is oldest date of snapshot.
calculate the cost per GB for old snapshots
$AllSnapshotsForRemoval variable can be fed to a foreach to delete the aged out snapshots
@Rugby-Ball
Rugby-Ball / aws-ec2-elb-detail-inventory-with-SecurityGroups-all-aws-regions.ps1
Last active August 14, 2024 15:47
Pull all EC2's and all ELB's with details includes the Security Groups each EC2 has accross all AWS Regions. #Inventory #Utility #AWS #Public #EC2 #AWS_Security_Groups #AWS_ELB #AWS_ALB
# aws-ec2-elb-detail-inventory-with-SecurityGroups-all-aws-regions.ps1
<#
Description: Pull all EC2's and all ELB's with details includes the Security Groups each EC2 has accross all AWS Regions.
*** This script assumes you have an AWS Profile setup in your PowerShell. This link explains how to set it up. https://www.virtualtothecore.com/using-aws-credentials-in-powershell-scripts/
Written: Ed Walsh
PowerShell.Core tested: Tested
Version: 1.3.0
Create Date : 5/1/2023
Revised Date: 8/14/2024
@Rugby-Ball
Rugby-Ball / AWS-IAM-Users-with-IAMGroups-Memberships.ps1
Created April 26, 2023 18:14
This will show the IAM Users and the IAM Group memberships they are in. #Utility #Inventory #Public #AWS #IAM #Security #Audit
# AWS-IAM-Users-with-IAMGroups-Memberships.ps1
<#
Description: This will show the IAM Users and the IAM Group memberships they are in.
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: 04/26/2023
Revised Date: 04/26/2023
#>
@Rugby-Ball
Rugby-Ball / change_IIS_site_ID.ps1
Last active August 15, 2023 14:42
This is how to change the IIS Site ID using Site ID # or IIS Site Name. #Utility #Inventory #WebServer #Public #Windows #IIS
#This is how to change the IIS Site ID using Site ID # or IIS Site Name.
Import-Module WebAdministration
# Pull all of the IIS Sites into variable $sm, after ; says to display on screen $sm.Sites list
$sm = Get-IISServerManager ; $sm.Sites
# Change site with Id 5 to Id 7
$site = $sm.Sites | where-object { $_.Id -eq 5 }
@Rugby-Ball
Rugby-Ball / dotNET_framework_Installed.ps1
Created April 21, 2023 01:34
This will check what .NET Framework installed on the server. #Utility #Inventory #Public #Windows #Framework #.NET
# This will check what .NET Framework installed on the server.
#
#From: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
$release = Get-ItemPropertyValue -LiteralPath 'HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release
switch ($release) {
{ $_ -ge 533320 } { $version = '4.8.1 or later'; break }
{ $_ -ge 528040 } { $version = '4.8'; break }
{ $_ -ge 461808 } { $version = '4.7.2'; break }
@Rugby-Ball
Rugby-Ball / aws-acm-inventory.ps1
Last active March 30, 2023 14:50
Pull a AWS Certificate Manager inventory list #Utility #AWS #Inventory #Public #AWS_ACM
# aws-acm-inventory.ps1
<#
Description: Pull an Inventory List from AWS Certificate Manager (ACM) across all AWS regions. Export to a CSV file.
Written: Ed Walsh
PowerShell.Core tested: Not Tested
MS-Graph: No
Version: 1.1.0
Create Date: 3/30/2023
Revised Date: 3/30/2023
#>
@Rugby-Ball
Rugby-Ball / running_server_list_from_ssm.ps1
Last active March 19, 2024 21:22
Use to pull a list of running servers (Windows and/or Linux depending on what you select in $Filters) removing any that are not in AD and are associated to WORKGROUP. #AWS #Utility #Public #Inventory #SSM
#running_server_list_from_ssm.ps1
#Use to pull a list of running servers (Windows and/or Linux depending on what you select in $Filters) removing any that are not in AD and are associated to WORKGROUP.
#3/29/2023
Import-Module -name AWSPowershell
$Servers = @()
# Get the Running EC2 Instances managed by SSM
$Filters = @(@{ Key = 'PingStatus'; values = 'Online' }; @{ key = "PlatformTypes"; values = ("Linux", "Windows") }; @{ Key = "ResourceType"; values = "EC2Instance" })
@Rugby-Ball
Rugby-Ball / Outlook-Calendar-Unavailable-list.ps1
Last active April 3, 2023 21:46
Pulls the Unavailable times for a range from your Outlook calendar and displays on the screen and also copies to Windows Clipboard for you so you can paste where you want. You can do something like this in Outlook; on a new Email, click INSERT and then Calendar. But I did not like the output format it does. This method was cleaner for me. #Utili…
#Outlook-Calendar-Unavailable-list.ps1
<#
Description: Pulls the Unavailable times for a range from your Outlook calendar and displays on the screen and also copies to Windows Clipboard for you so you can paste where you want.
You can do something like this in Outlook; on a new Email, click INSERT and then Calendar. But I did not like the output format it does.
This method was cleaner for me.
Written: Ed Walsh
PowerShell.Core tested: Not Tested
MS-Graph: No
Version: 1.1
Create Date: 3/20/2023
@Rugby-Ball
Rugby-Ball / AWS_SecurityGroups_to_EC2_List.ps1
Created February 22, 2023 00:16
Pulls a list of AWS Security Groups and the EC2's they are assigned to. Exports to Excel, with two Pivot Tables. #Security #Utility #AWS #Inventory #Public #EC2 #AWS_Security_Groups
# AWS_SecurityGroups_to_EC2_List.ps1
<#
Description: Pulls a list of AWS Security Groups and the EC2's they are assigned to. Exports to Excel, with two Pivot Tables.
Written: Ed Walsh
PowerShell.Core tested: Not Tested
MS-Graph: No
Version: 1.0.0
Create Date: 2/21/2023
Revised Date: 2/21/2023
#>
@Rugby-Ball
Rugby-Ball / EC2-Inventory_with-Details.ps1
Created February 14, 2023 00:32
Get EC2 Instance List (Inventory) with Details Output to CSV file and Gridview. CSV file in User Documents Profile Folder. #Utility #Public #Inventory #AWS #EC2
## EC2-Inventory_with-Details.ps1
## Get EC2 Instance List (Inventory) with Details Output to CSV file and Gridview. CSV file in User Documents Profile Folder.
## Written: Ed Walsh
## Date: 11/1/2018
## PowerShell Version Compatible: PS v5.1, or Comment out Gridview Line for PS v6+
## Version: 1.2.0
## Revision Date: 10/4/2019 Added Dedicated Tenant check and column.
## Revision Date: 06/30/2020 Added Description column.
## Revision Date: 12/16/2021 Made this run accross all AWS Regions