Test-Message Improvements in Exchange 2010 Sp1

 

You may be familiar with the Test-Message cmdlet. If not check out this link here-

https://technet.microsoft.com/en-us/library/dd298101(EXCHG.140).aspx

Basically this cmdlet is useful for testing inbox rules. However rather than talking about the above link let’s discuss the newer and improved Test-Message that ships with SP1 and show some cool uses for this unsung little cmdlet.

First off we added some new switches which for some reason have not been documented on TechNet yet.

So without further ado here are all the switches for the SP1 version-

Parameter

Description

Recipients

The Recipients parameter specifies the list of e-mail addresses to be used as recipients for the test message if an .eml or .msg file isn't specified.

Confirm

The Confirm switch causes the command to pause processing and requires you to acknowledge what the command will do before processing continues. You don't have to specify a value with the Confirm switch.

DeliverMessage

The DeliverMessage switch specifies that the message should be delivered to its final destination. If you don't specify this switch, the message that's resubmitted isn't delivered to its recipients. Only troubleshooting data is generated and sent to the specified recipient.

MessageFileData

The MessageFileData parameter specifies file data retrieved from an .eml OR .msg file using the Get-Content cmdlet.

Sender

The Sender parameter specifies the SMTP address to be used as the message sender for the test message if an .eml or .msg file isn't specified.

SendReportTo

The SendReportTo parameter specifies the e-mail address to which the final report is sent.

Arbitration

This switch retrieves a report for all messages in the arbitration mailbox used for moderation. If this switch is used you then specify the arbitration mailbox email with the -recipients parameter

InboxRules

This switch retrieves a report for all rules within the mailbox that you specify with –recipients parameter. It will provide useful diagnostic info for which rules fired or did not.

WhatIf

The WhatIf switch instructs the command to simulate the actions that it would take on the object. By using the WhatIf switch, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf switch.

If you recall the RTM version you will notice 2 new switches have been added-

-Arbitration and –InboxRules.

The –Arbitration switch creates diagnostic info on the initiation messages in the arbitration mailbox and their various statuses. As you may recall the arbitration mailbox is used for the new moderated messaging framework introduced in Exchange 2010.

To run these tests you would run the following one liner-

clip_image002

For –Recipients you will need to specify the arbitration mailbox. To get this value just run ‘Get-Mailbox –Arbitration |FL Name’. You should get an output that is similar to the one below-

Name : SystemMailbox{1f05a927-2941-4ce4-8c27-852e25e0abc8}

Name : SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}

Name : FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042

The above are the Arbitration, Discovery and Federated mailboxes respectively.

The last two will always have the same value but for the arbitration mailbox the last 4 sets of guids will be unique to your environment. More can be found here-https://technet.microsoft.com/en-us/library/bb201680.aspx

In summary the previous one liner will send a report to the mailbox that you specified with –SendReportTo as such-

clip_image004

The fields above are pretty self-explanatory but I will elaborate on some below-

‘Initiation Message’ is the unique ID that is assigned to the arbitration message.

‘Moderated Recipient Address’ is the name of the moderated account (in the above example it is a DL called Expand1).

‘Moderators’ is a list of moderators.

The ‘Moderators (total; not delivered; away)’ tell us how many moderators there were and how many generated NDRs (not delivered) or OOF messages (away). In the above example we have 1 moderator and no NDRs or OOF messages sent from the moderator address.

The ‘Decision maker’ field displays which moderator ultimately approved/disapproved the message with the corresponding status and time in addition to the time the moderation request message will be expired.

Finally the attached ‘formattedDetails.txt’ is just the raw data that you see in the report.

The –InboxRules switch creates a similar report but one evaluating which inbox rules did or did not fire.

You would run it like so-

clip_image006

The report generated will look like this-

clip_image008

First we see that the hidden Junk mail rule skipped this message due to the fact that it is an internal email and thus automatically will get an SCL of -1.

Then we a rule called ‘zeppo marx’ has evaluated to true. This rule moves all messages coming from zeppo marx to a folder called ‘Personal’-

clip_image010

You will also see if the mailbox has OOF auto replies enabled as well-

clip_image012

Attached to the report you will also find ‘Mailbox-Rules.xml’ which is a dump of all the rules in that particular mailbox in xml format as well as ‘Automatic- Reply-History.xml’ which is a dump of all the recipients that had an OOF message fire.

Now in addition to the above one of the other cool new features of the SP1 test-Message cmdlet is the ability to send a native MAPI .MSG message in addition to .EML.-

clip_image014

 

In the above we sent a ‘test.msg’ pre-created message to zmarx@wingtiptoys

Ok that’s all for now.

Thanks for reading.