<# .SYNOPSIS Stops routing mail through Innovarro Signatures (roll back), or removes the configuration completely. .DESCRIPTION Default: disables the transport rule "Innovarro Signatures". Mail flows directly again within a minute or two; the connectors stay in place so you can turn signing back on with Install-InnovarroSignatures.ps1. The Outlook add-in keeps working independently; remove it in the Microsoft 365 admin center if needed. -Remove: deletes the transport rule and both connectors. You are asked to confirm each deletion (add -Confirm:$false to skip the prompts). .EXAMPLE .\Disable-InnovarroSignatures.ps1 .EXAMPLE .\Disable-InnovarroSignatures.ps1 -Remove .NOTES Innovarro Signatures - https://signatures.innovarro.cloud/support #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param([switch]$Remove) $ErrorActionPreference = 'Stop' $RuleName = 'Innovarro Signatures' $OutboundName = 'Innovarro Signatures' $InboundName = 'Innovarro Signatures - return' if (-not (Get-Command Get-ConnectionInformation -ErrorAction SilentlyContinue)) { throw 'The ExchangeOnlineManagement module is not installed. Run: Install-Module ExchangeOnlineManagement -Scope CurrentUser' } if (-not (Get-ConnectionInformation | Where-Object State -eq 'Connected')) { Connect-ExchangeOnline -ShowBanner:$false } $rule = Get-TransportRule -Identity $RuleName -ErrorAction SilentlyContinue if (-not $Remove) { if (-not $rule) { Write-Host "Transport rule '$RuleName' not found - nothing to disable." -ForegroundColor Yellow; return } # Rolling back is the safe direction, so it does not prompt. Disable-TransportRule -Identity $RuleName -Confirm:$false Write-Host "Transport rule '$RuleName' disabled. Mail is no longer routed through the relay." -ForegroundColor Green Write-Host 'Turn it back on with Install-InnovarroSignatures.ps1 (same parameters as before).' return } # The rule must go first: a connector that a rule still points to cannot be removed. if ($rule -and $PSCmdlet.ShouldProcess($RuleName, 'Remove transport rule')) { Remove-TransportRule -Identity $RuleName -Confirm:$false; Write-Host "Removed transport rule '$RuleName'" -ForegroundColor Green } if ((Get-OutboundConnector -Identity $OutboundName -ErrorAction SilentlyContinue) -and $PSCmdlet.ShouldProcess($OutboundName, 'Remove outbound connector')) { Remove-OutboundConnector -Identity $OutboundName -Confirm:$false; Write-Host "Removed outbound connector '$OutboundName'" -ForegroundColor Green } if ((Get-InboundConnector -Identity $InboundName -ErrorAction SilentlyContinue) -and $PSCmdlet.ShouldProcess($InboundName, 'Remove inbound connector')) { Remove-InboundConnector -Identity $InboundName -Confirm:$false; Write-Host "Removed inbound connector '$InboundName'" -ForegroundColor Green } Write-Host "`nExchange Online no longer uses Innovarro Signatures. Remember to remove the relay from your SPF records" ` "and the Outlook add-in (Microsoft 365 admin center > Settings > Integrated apps) if you are leaving the service."