One of Important and precious facility provided by Exchange Serve is “Message Tracking Logs”. The whole transfer of messages (Send/Receive) can be easily monitored using this Feature of Exchange Server.
In Exchange server Edge Transport, Mail Servers and Hub Transport layers are responsible for the transmission of messages in the network. Message Tracking Logs can be called as the feature of these server roles. Tracking of message becomes sometimes necessary in troubleshooting the Exchange problems.
Now, In this blog, We will learn PowerShell Commands with which one can easily track messages.
One can use the Get-MessageTrackingLog Cmdlet in the EMC to search Message Tracking Logs. The Cmdlet will give the tracking logs with all associated parameters as shown in figure.
Parameter “–Server” can be used to search remote server. This is mostly used when there are separate management Servers.
Searches of Message Tracking Logs on Hub Transport Server can be performed by using the command given below.
To search a particular server within a site one can use the Cmdlet given below.
After that, insert Cmdlet to the Get-MessageTrackingLog as shown below.
One important point to be noted is that the command given above will only return 1000 results, as its default size is set to the 1000 results. To modify the results use “–Resultsize” Cmdlets
If you are searching the logs in many servers than it is recommended to save the results of all the queries in a variable, so that we can use it in the future, if required.
The PowerShell Cmdlet given below is used to track the emails of Jay. The result of the command is stored in a different variable $msgs as shown below
To count the number of mails stored in the $msgs, use the command $msgs.count as shown below.
There is no need to run the whole command again to search first 5 Sender, Just write Select –First 5 as shown in the fig.
Each message as shown above generates lots of log entries. That happens because every message that is sent or received has to pass through many events such as
Use command Export –CSV, If you want to store the results of Message Tracking logs to the CSV file. One problem with the command is that when you tries to analyze data from CSV, you will not find any useful information. It will show the names as System.String[] as shown below.
You have to pipe the results of tracking logs in Cmdlet to resolve the issue: –
Now you will find the resultant data in the original form