zoukankan      html  css  js  c++  java
  • Powershell Exchange Message Per Day Sent and Reveive

    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
        
    } 
  • 相关阅读:
    leetcode5
    leetcode4
    maven笔记
    枚举使用笔记
    List遍历删除解决方案:遍历删除,迭代删除,removeIf
    java笔记(web部分)
    webview使用
    json数据格式+gson解析json问题总结
    android:layout_weight的简单使用
    欢迎界面效果
  • 原文地址:https://www.cnblogs.com/thescentedpath/p/perday.html
Copyright © 2011-2022 走看看