Notice: Due to size constraints and loading performance considerations, scripts referenced in blog posts are not attached directly. To request access, please complete the following form: Script Request Form Note: A Google account is required to access the form.
Disclaimer: I do not accept responsibility for any issues arising from scripts being run without adequate understanding. It is the user's responsibility to review and assess any code before execution. More information

Exchange : Transport Rule Debugging

If you have lots of mail transport rules and need to see which apply to a message then help is at hand!

You can use the Test-Message command to complete this action, the option below will focus on the Transport rules only:

Test-Message -Sender Crazy.Bear@grizzlybear.me -Recipients bears@pokebearwithsticks.com -SendReportTo Crazy.Bear@grizzlybear.me -TransportRules
 
If you wish to include DLP with this you can run this:

Test-Message -Sender Crazy.Bear@grizzlybear.me -Recipients bears@pokebearwithsticks.com -SendReportTo Crazy.Bear@grizzlybear.me -TransportRules -UnifiedDlpRules


 Note : You will receive a message for both options, so if you ask for Tranport and DLP you will get two e-mail which will come from postmaster.

However if you want to include some specific keywords in the message subject or body text, or an attachment of a certain type create the message in Outlook have it as a MSG file in a valid location, then you can pass that MSG files to the PowerShell command, by setting the variable of the MSG file first:
 
$EncodedText = ([System.IO.File]::ReadAllBytes('c:\temp\TestMessage.msg'))

Then run the PowerShell below to use that file in the analysis, the example below does both Transport and DLP:

Test-Message -MessageFileData $EncodedText -Sender
Crazy.Bear@grizzlybear.me -Recipients bears@pokebearwithsticks.com -SendReportTo Crazy.Bear@grizzlybear.me -TransportRules -UnifiedDlpRules
Previous Post Next Post

نموذج الاتصال