In Exchange Powershell, we often encounter this situation when managing the daily mailbox sending and receiving count of Exchange servers. The boss wants to know how many emails each mailbox sends every day? How many emails do we send on our server per day or month? Or how many failed emails are sent to a specific address on the server? These cannot be implemented in Exchange graphical management, or they must be implemented using third-party tools. Next we will introduce the powerful Powershell management of Exchange, and several commands will solve the above problems. Www.2cto.com
1. collect statistics on the sending status of a HUB server over the last period: [PS] C: \ Windows \ system32> Get-Limits-ResultSize unlimited-Start "07/01/2012"-End "07/13/2012"-EventId "send"-Server "srvbj06" | the Measure-ObjectResultSize unlimited parameter shows all. Add Measure-Object as the numeric attribute of the computing Object and the sum of the string objects. If this parameter is removed, it is displayed one by one.
-Eventid can include BadMail, Defer Deliver, DSN, Expand, Fail, receivonmessage, Receive, Redirect, Resolve, Send, Submit, and Transfer. To retrieve the mail status. For example, the following uses the Fail parameter to retrieve the number of failed mails sent within a period of time: [PS] C: \ Windows \ system32> Get-MessageTrackingLog-ResultSize unlimited-Start "07/01/2012"-End "07/13/2012"-EventId "Fail"-Server "srvbj06" | Measure-Object
2. query the sending status of a mailbox: [PS] C: \ Windows \ system32> Get-MessageTrackingLog-ResultSize unlimited-Start "07/01/2012"-End "07/13/2012"-EventId "send"-Sender "luochen@bpdi.com.cn" | Measure-Object
The following shows which emails in this mailbox fail to be sent [PS] C: \ Windows \ system32> Get-MessageTrackingLog-ResultSize unlimited-Start "07/01/2012"-End "07/13/2012"-EventId "FAIL"-Sender luochen@XX.com
3. Send messages within a period of time by mailbox: add the Group-Object command to Group statistics. Here we calculate the Count value, Group the Count, and use select to filter. Www.2cto.com [PS] C: \ Windows \ system32> Get-MessageTrackingLog-ResultSize unlimited-Start "07/01/2012"-End "07/13/2012"-EventId "send" | Group-Object-Property: sender | select name, count
The above statistics show the sending status of each mailbox, And the sort is added below to sort the count value, so that you can find the mailbox that sends the most. [PS] C: \ Windows \ system32> Get-MessageTrackingLog-ResultSize unlimited-Start "07/01/2012"-End "07/13/2012"-EventId "send" | Group-Object-Property: sender | Select name, count | sort count-Descending
Author Li Yu