<# .SYNOPSIS MailPulse SMTP AUTH readiness check (READ-ONLY). .DESCRIPTION *** THIS SCRIPT IS READ-ONLY. IT MAKES NO CHANGES TO YOUR TENANT. *** It only uses Get- cmdlets (plus Connect-/Disconnect-ExchangeOnline). It does not call any Set-, New-, Remove- or Enable- cmdlet and it does not read email. It writes one file, mailpulse-tenant.json, on this computer. Nothing is uploaded. You choose whether to open it on the MailPulse SMTP AUTH Readiness Scan page, where it is read inside your browser. What it reads: - Get-TransportConfig organisation-wide SmtpClientAuthenticationDisabled - Get-CASMailbox mailboxes where SMTP AUTH is explicitly switched ON (SmtpClientAuthenticationDisabled = $false) - Get-AuthenticationPolicy policies that allow or block basic SMTP - Get-InboundConnector connectors that let devices send without a password - Get-OrganizationConfig RejectDirectSend (only if your tenant has the property) Note on Security Defaults: if Security Defaults is switched on in Microsoft Entra, basic (username and password) sign-in is already blocked for everyone, so printers using it have probably stopped already. This script cannot see that setting (it makes no Graph calls). Check it in Entra admin center > Identity > Overview > Properties > Manage security defaults. .REQUIREMENTS PowerShell 5.1 or 7+, and the module: Install-Module ExchangeOnlineManagement -Scope CurrentUser An account with a read-only Exchange role (Global Reader, Security Reader or View-Only Organization Management). .EXAMPLE .\MailPulse-Check.ps1 .\MailPulse-Check.ps1 -OutFile C:\Temp\mailpulse-tenant.json #> param( [string]$OutFile = ".\mailpulse-tenant.json" ) $ErrorActionPreference = 'Stop' Write-Host "" Write-Host "=====================================================================" -ForegroundColor Green Write-Host " MailPulse SMTP AUTH check - READ-ONLY. This script makes NO changes." -ForegroundColor Green Write-Host " It only runs Get- commands and writes one file: $OutFile" -ForegroundColor Green Write-Host "=====================================================================" -ForegroundColor Green Write-Host "" if (-not (Get-Module -ListAvailable -Name ExchangeOnlineManagement)) { Write-Host "The ExchangeOnlineManagement module is missing. Install it with:" -ForegroundColor Yellow Write-Host " Install-Module ExchangeOnlineManagement -Scope CurrentUser" exit 1 } Import-Module ExchangeOnlineManagement Write-Host "Signing in to Exchange Online (a Microsoft sign-in window will open)..." Connect-ExchangeOnline -ShowBanner:$false try { Write-Host "1/5 Reading organisation-wide SMTP AUTH setting..." $transport = Get-TransportConfig $transportOut = [ordered]@{ SmtpClientAuthenticationDisabled = $transport.SmtpClientAuthenticationDisabled } Write-Host "2/5 Reading mailboxes with SMTP AUTH explicitly enabled (this can take a few minutes in large tenants)..." $mailboxes = @() $mailboxScanSkipped = $false try { $mailboxes = @(Get-CASMailbox -ResultSize Unlimited | Where-Object { $_.SmtpClientAuthenticationDisabled -eq $false } | ForEach-Object { [ordered]@{ UserPrincipalName = [string]$_.PrimarySmtpAddress; DisplayName = [string]$_.DisplayName } }) } catch { $mailboxScanSkipped = $true Write-Host " Could not read mailboxes: $($_.Exception.Message)" -ForegroundColor Yellow } Write-Host "3/5 Reading authentication policies..." $policies = @() try { $policies = @(Get-AuthenticationPolicy | ForEach-Object { [ordered]@{ Name = [string]$_.Name; AllowBasicAuthSmtp = $_.AllowBasicAuthSmtp } }) } catch { Write-Host " Could not read authentication policies: $($_.Exception.Message)" -ForegroundColor Yellow } Write-Host "4/5 Reading inbound connectors..." $connectors = @() try { $connectors = @(Get-InboundConnector | ForEach-Object { [ordered]@{ Name = [string]$_.Name Enabled = $_.Enabled ConnectorType = [string]$_.ConnectorType SenderIPAddresses = @($_.SenderIPAddresses | ForEach-Object { [string]$_ }) SenderDomains = @($_.SenderDomains | ForEach-Object { [string]$_ }) } }) } catch { Write-Host " Could not read inbound connectors: $($_.Exception.Message)" -ForegroundColor Yellow } Write-Host "5/5 Reading organisation settings (Direct Send)..." $orgOut = [ordered]@{} try { $org = Get-OrganizationConfig if ($org.PSObject.Properties.Name -contains 'RejectDirectSend') { $orgOut['RejectDirectSend'] = $org.RejectDirectSend } } catch { Write-Host " Could not read organisation config: $($_.Exception.Message)" -ForegroundColor Yellow } $result = [ordered]@{ tool = 'MailPulse-Check' version = 1 generatedAt = (Get-Date).ToUniversalTime().ToString('o') readOnly = $true transportConfig = $transportOut mailboxesWithSmtpAuthEnabled = $mailboxes mailboxScanSkipped = $mailboxScanSkipped authenticationPolicies = $policies inboundConnectors = $connectors organizationConfig = $orgOut } $result | ConvertTo-Json -Depth 6 | Set-Content -Path $OutFile -Encoding UTF8 Write-Host "" Write-Host "Done. Nothing was changed in your tenant." -ForegroundColor Green Write-Host "Saved: $((Resolve-Path $OutFile).Path)" Write-Host "Now open https://mailpulse.smartaioffice.online/tenant and upload that file (it is read in your browser, not uploaded to a server)." } finally { Disconnect-ExchangeOnline -Confirm:$false | Out-Null }