Posts

Showing posts from November, 2018

Gather SPF Records For Multiple Domain Names

You can use the following script to gather the SPF records for multiple domains.  You just need to populate a TXT file named DomainNames.txt which exists in the same directory.  Below is the PowerShell: $SPFRecords = @ () $Counter = 0 $myDir = Split-Path -Parent $MyInvocation .MyCommand.Path $DomainNames = Get-Content $myDir \DomainNames.txt $SPFOutput = $myDir + "\SPFRecordsResults.csv" ForEach ( $Domain in $DomainNames ) { $Counter ++ Write-Progress -Activity "Querying SPF Records" -Status "Processing $( $ Counter) of $( $ DomainNames.count) " -CurrentOperation $Domain -PercentComplete (( $Counter / $DomainNames .count) * 100) $SPFRecord = Resolve-DNSName -Name $Domain -Type TXT | Where { $_ .Strings -like "*spf1*" } If ( $SPFRecord -ne $NULL ) { ForEach ( $SPF in $SPFRecord ) { $SPFItem = new-object PSObject -Property @ { Domain = $SPF .Name