spf.ps1
function Get-SpfRecord() { param( [string]$domain ) $spf = Resolve-DnsName -Name $domain -Type TXT -Server 1.1.1.1 if ($spf) { return $spf | Where-Object { $_.QueryType -eq "TXT" } | Select-Object -ExpandProperty Strings | Where-Object { $_ -like "v=spf1*" } } else { $spf = Resolve-DnsName -Name $domain -Type CNAME | Where-Object { $_.QueryType -eq "CNAME" } | Select-Object -ExpandProperty NameHost if ($spf) { Get-SpfRecord -domain $spf } } } |