RSS

统计hub上的发送和接收数量

01 Feb

想要去做报表怎么能少了这个脚本?大家随我来看

$hubsvrs = Get-ExchangeServer | ? {$_.serverrole -like '*hub*' -and $_.site -like'*xunyangit'} | sort name |select name
 
$starttime = (Get-date).AddDays(-2).toLongDateString()
 
$endtime = (Get-date).AddDays(-1).toLongDateString()
 
write-host -ForegroundColor green "message report from $starttime to $endtime"
 
$Tolrece = 0
 
$tolsent = 0
 
foreach ($hubsvr in $hubsvrs) 
 
{
 
$msgstatus = Get-MessageTrackingLog -server $hubsvr.name -Start $starttime -End $endtime -resultsize unlimited | where { $_.Eventid -eq "Send" -or $_.Eventid -eq "Receive" }| Group-object Eventid | sort name 
 
$msgstatus | select @{name="server";expression={$hubsvr.name}},Name,Count
 
$Tolrece = $msgstatus[0].count + $Tolrece
 
$tolsent = $msgstatus[1].count + $tolsent
 
}
 
write-host -ForegroundColor green "total receive $tolrece "
 
write-host -ForegroundColor green "total send $tolsent "

请将上列命令保存到ps1文件中,并运行,最终运行该ps1后,得到下列数据:

请注意:此脚本默认仅查询昨日的信息,你可以按照需求去修改。

Advertisements
 
1 Comment

Posted by on February 1, 2010 in Exchange Server

 

One response to “统计hub上的发送和接收数量

  1. February 1, 2010 at 12:06

    哇,好多HUB 。。牛啊!!

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: