Exchange serverGet-MailTrafficTopReport
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Exchange serverGet-MailTrafficTopReport相关的知识,希望对你有一定的参考价值。
#在EXO中有Get-MailTrafficTopReport,官网: https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailtraffictopreport?view=exchange-ps 这个report可以很直观的查处一定时间内每个邮箱的发送量,但是在本地Exchange服务器中却没有。
#以下脚本调用了Exchange服务器的get-messagetrackinglog,以及.count()方法,来拿到和EXO get-mailtraffictopreport一样的发送数据
#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-mailtraffictopreport
#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: emp)"
$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
以上是关于Exchange serverGet-MailTrafficTopReport的主要内容,如果未能解决你的问题,请参考以下文章
Exchange2007升级到Exchange2013——配置新旧版本共存
Exchange Server2010 升级至Exchange Server 2016--01(知识点)