blog.icewolf.ch

Let's talk about IT!
posts - 2247, comments - 295, trackbacks - 0

My Links

Archives

Post Categories

icewolf

Get-Mailprotection published to PowerShell Gallery

Hi All,

My work as a Cloud Engineer is around M365 and Azure. As a Messaging Expert, i often use DNS to Query for diffrent Records like MX, SPF, DKIM, DMARC etc.

A while ago, i startet to create a Script that checks all these Settings for a specific Domain. The Script has been published to my GitHub Repo.

The Script checks diffrent DNS Records about a Domain - mostly about Mailsecurity Settings. It checks for the following Information

  • DNS Zone Signed (DNSSEC)
  • CAA (Certification Authority Authorization)
  • MX (MailExchanger)
  • MX IP
  • MX Reverse Lookup
  • Connects to the MX Servers and checks for STARTTLS and shows Certificate Information
  • SPF (Sender Policy Framework)
  • DKIM (DomainKeys Identified Mail)
  • DMARC (Domain-based Message Authentication, Reporting and Conformance)
  • DANE (DNS-based Authentication of Named Entities)
  • BIMI (Brand Indicators for Message Identification)
  • MTA-STS (SMTP MTA Strict Transport Security)
  • MTA-STS Web (https://mta-sts.domain.tld/.well-known/mta-sts.txt)
  • TLS-RPT (TLS Reporting)
  • Lyncdiscover
  • Lync/Skype/Teamsfederation
  • M365 (Check via Open ID Connect)
  • M365 TenantID

Recently i did learn, that you can publish a Script in the PowerShell Gallery. This is how it's done.

New-ScriptFileInfo

New-ScriptFileInfo -Path C:\Temp\Get-Mailprotection.ps1 -Description "This Script checks diffrent DNS Records about a Domain - mostly about Mailsecurity Settings"
Get-Content C:\Temp\Get-Mailprotection.ps1



I have addet these Informations to the Script. Then i have created an API Key in the PowerShell Gallery.



Publish-Script -Path <Path to PowerShell Script> -NuGetApiKey <ApiKey>



Find-Script Get-Mailprotection
Find-Script Get-Mailprotection | fl


To install the Script you need to use the following Command

Install-Script Get-Mailprotection


Now you can use the Script. The Result Variable then contains all the Values.

$Result = Get-Mailprotection.ps1 -Domain serveralive.ch



Regards
Andres Bohren


Print | posted on Saturday, October 8, 2022 3:23 PM | Filed Under [ Exchange PowerShell ]

Powered by:
Powered By Subtext Powered By ASP.NET