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
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