Created
December 2, 2020 11:37
-
-
Save mardahl/93a7f8abea62f55a52ad41727024e610 to your computer and use it in GitHub Desktop.
Office 365 DKIM DNS records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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