Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A script for statistics of Exchange mail sending and receiving monthly reports

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Goal: count the amount of mail sent and received each month on a regular basis.

Add-PSSnapin microsoft.exchange*$Server= "MBX1.liuxing.com", "MBX2.liuxing.com", "MBX03.liuxing.com", "MBX4.liuxing.com", "MBX5.liuxing.com" $today=get-date$m=$today.AddDays (- 1) $MonthNo=-join ($m.Yearma.Month) $s = ($m.Month, "01", $m.Year)-join "/" if ($m.Month-eq 2) {$e = ($m.Month, "28") $m.Year)-join "/"} elseif ($m.Month-eq 4-or $m.Month-eq 6-or $m.Month-eq 9-or $m.Month-eq 11) {$e = ($m.Month, "30", $m.Year)-join "/"} else {$e = ($m.Month, "31") $m.Year)-join "/"} $st= "$s 00:00:00" $et= "$e 23:59:59" $file= "Reports-$MonthNo.csv" $SCount=$RCount=$DSNCount=0foreach ($I in $Server) {$temp=Get-MessageTrackingLog-Server $I-Start "$st"-End "$et"-ResultSize unlimited foreach ($j in $temp) {if ($j.EventId-eq "RECEIVE"-and $j.Source-eq "STOREDRIVER") {$SCount++} if ($J. EventId-eq "DELIVER") {$RCount++} if ($j.EventId-eq "DSN") {$DSNCount++}} write-output "$i send email count: $SCount" | Out-File-Append C:\ reports\ $file write-output "$i receive email count: $RCount" | Out-File-Append C:\ reports\ $file write-output "$i dsn email count: $DSNCount" | Out-File-Append C:\ reports\ $file}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report