码迷,mamicode.com
首页 > 系统相关 > 详细

Powershell Exchange Message Per Day Sent and Reveive

时间:2017-06-29 20:26:42      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:res   hold   eventid   nts   sage   use   track   form   shell   

Powershell Exchange Message Per Day Sent and Reveive

# Initialize some variables used for counting and for output
Get-Date -UFormat "%Y-%m-%d-%H-%M" >>Per-day_recive.txt

$Account="wendychen"
[Int64] $intSent = $intRec = 0
[Int64] $intSentSize = $intRecSize = 0
[String] $strEmails = $null

$times=Import-CSV "d:\LOGTime.csv"
foreach ($time in $times) 
{ 
    # Start building the variable that will hold the information for the day  
 $starttime=$time.starttime
 $endtime=$time.endtime
 echo $starttime $endtime ssss
    $intSent = $intRec = 0 
    (Get-TransportServer -Identity wendy-*) | Get-MessageTrackingLog -ResultSize Unlimited -Recipients "$Account" -Start "$starttime" -End "$endtime" | ForEach { 
        # Sent E-mail
        If ($_.EventId -eq "RECEIVE" -and $_.Source -eq "STOREDRIVER")
        {
            $intSent++
            $intSentSize += $_.TotalBytes
        }
         
        # Received E-mails 
        If ($_.EventId -eq "DELIVER")
        {
            $intRec++
            $intRecSize += $_.TotalBytes
        }
                       } 
 
    $intSentSize = [Math]::Round($intSentSize/1MB, 0)
    $intRecSize = [Math]::Round($intRecSize/1MB, 0)

$DataBase = Get-Mailbox -Identity $Account |Get-MailboxStatistics

        Write-Host "$Account,`nintSentSize=$intSentSize,`nReciveSize=$intRecSize" -ForegroundColor Yellow
    $DataBase.DisplayName,$DataBase.DataBaseName,$starttime,$endtime,$intRecSize,$intSentSize -join ";">>d:\"$Account"-Per-day_recive.csv
    
} 

 

Powershell Exchange Message Per Day Sent and Reveive

标签:res   hold   eventid   nts   sage   use   track   form   shell   

原文地址:http://www.cnblogs.com/scentpath/p/perday.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!