Skip to content

Instantly share code, notes, and snippets.

@mardahl
Created December 2, 2020 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardahl/93a7f8abea62f55a52ad41727024e610 to your computer and use it in GitHub Desktop.
Save mardahl/93a7f8abea62f55a52ad41727024e610 to your computer and use it in GitHub Desktop.
Office 365 DKIM DNS records
#requires -RunAsAdministrator
Set-ExecutionPolicy Bypass -Confirm:$false -Force
Install-Module ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
try{
Connect-ExchangeOnline -ErrorAction Stop
} catch {
Throw "Failed to logon to Exchange Online"
}
$dkim = Get-DkimSigningConfig | Where-Object Identity -NotLike "*onmicrosoft*"
foreach($obj in $dkim){
Write-Host "DNS records for $($obj.Domain)" -ForegroundColor Green
Write-Output " TYPE = CNAME"
Write-Output " TTL = 900"
Write-Output " HOSTNAME = selector1._domainkey.$($obj.Domain)"
Write-Output " VALUE = $($obj.Selector1CNAME)"
Write-Output " TYPE = CNAME"
Write-Output " TTL = 900"
Write-Output " HOSTNAME = selector2._domainkey.$($obj.Domain)"
Write-Output " VALUE = $($obj.Selector2CNAME)"
Write-Output " "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment