Skip to content

Instantly share code, notes, and snippets.

@Rugby-Ball
Last active October 5, 2023 02:44
Show Gist options
  • Select an option

  • Save Rugby-Ball/aee4f671454dff5f9c7976545e4ed225 to your computer and use it in GitHub Desktop.

Select an option

Save Rugby-Ball/aee4f671454dff5f9c7976545e4ed225 to your computer and use it in GitHub Desktop.
Using the PowerShell Module DomainHealthChecker, pull all AWS Hostedzone ID's and pull inventory of SPF records for each HostedZone. #Utility #Inventory #AWS #Route_53 #SPF #email #Public
# aws-rt53-hostedzone-spf-inventory.ps1
#Install-Module -name DomainHealthChecker # Only needed if you don't already have the Module installed
import-module -name DomainHealthChecker, AWSPowerShell.netcore
$all = @()
$urls_check = Get-R53HostedZoneList
foreach ($url in $urls_check) {
$all += get-spfrecord -Name $url.name | Select-Object @{ name="HostedZoneID";e={$url.id.substring(12)} }, @{ name="HostedZone";e={$url.name.trimend(".")} } , SPFRecord
}
$all | sort-object HostedZone | Format-Table -AutoSize -Wrap #| clip # replace clip with pbcopy for MacOS - Copies output to clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment