#在EXO中有Get-MailTrafficTopReport,官网: https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailtraffictopreport?view=exchange-ps 这个report能够很直观的查处必定时间内每一个邮箱的发送量,可是在本地Exchange服务器中却没有。web
#如下脚本调用了Exchange服务器的get-messagetrackinglog,以及.count()方法,来拿到和EXO get-mailtraffictopreport同样的发送数据shell
#There is Get-MailTrafficTopReport in EXO, official website: https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailtraffictopreport?view=exchange-ps This report can be intuitively investigated for a certain period of time The sending volume of each mailbox, but not in the local Exchange server.服务器
#The following script calls the get-messagetrackinglog of the Exchange server and the .count() method to get the same sending data as EXO get-mailtraffictopreportdom
#The below parts needs to be your Exchange server accepted domains #如下是您本地Exchange服务器上配置的域名 $AcceptedDomains = @("speridian.com","truecoverage.com","sesameindia.com","speridiantec.onmicrosoft.com","finalign.com") #================================================ #No need to modify the below parts #如下部分无需更改 $StartDate = Get-Date (Read-Host -Prompt 'Enter the start date, Eg. 05/01/2020 14:00:00') $StartDate = $StartDate.tostring("MM/dd/yyyy hh:mm:ss") $endDate = Get-Date (Read-Host -Prompt 'Enter the end date, Eg. 05/08/2020 18:00:00') $endDate = $endDate.tostring("MM/dd/yyyy hh:mm:ss") $CSV = Read-Host "Enter the Export CSV file location (E.g C:\temp)" $result = @() $Filter = "" $i = 0 Foreach($AcceptedDomain in $AcceptedDomains) { if($i -eq 0) { $Filter = '($_.recipientaddress -notlike "*' + $AcceptedDomain + '*")' }else{ $Filter += ' -and ($_.recipientaddress -notlike "*' + $AcceptedDomain + '*")' } $i++ } $mailoxes = get-mailbox -resultsize unlimited $Count = 0 Foreach($mailbox in $mailboxes) { $Count++ $Percent = ($Count/($mailboxes.count)) * 100 Write-Progress -Activity "Search in Progress" -Status "$Percent% Complete:" -PercentComplete $Percent; $Tracking = Get-MessageTrackingLog -Start $StartDate -End $EndDate -Sender $mailbox.primarysmtpaddress -resultsize unlimited| where{($filter)} $result += [PScustomobject]@{ Sender = $mailbox.primarysmtpaddress Count = $tracking.count } } $result | export-csv ($CSV+"\OutboundMailTrafficReport"+$runDate+".csv") -NoTypeInformation -Encoding utf8