# 每天收发邮件数
# https://gallery.technet.microsoft.com/scriptcenter/Count-sent-and-recceived-f9c66cf7 # 获取邮箱使用情况、以及最后一次logon时间
$allUser=Get-Mailbox -ResultSize Unlimited $allUser | select Id,DisplayName,ProhibitSendReceiveQuota | Export-Csv -Encoding UTF8 D:\all-users.csv -NoClobber -NoTypeInformation -Force #Clear-Content d:\user-list.csv -Force
echo "Identity#DisplayName#ProhibitSendReceiveQuota#TotalItemSize#LastLogonTime" > d:\user-list.csv Import-Csv -Path D:\all-users.csv | %{
$u_id=$_.Id
$u_DisplayName=$_.DisplayName
$u_ProhibitSendReceiveQuota=$_.ProhibitSendReceiveQuota
Get-MailboxStatistics -Identity $u_id | %{
$u_TotalItemSize = $_.TotalItemSize
$u_LastLogonTime = $_.LastLogonTime
} $line="$u_id"+"#"+"$u_DisplayName"+"#"+"$u_ProhibitSendReceiveQuota" + "#" + "$u_TotalItemSize" + "#" + "$u_LastLogonTime"
echo $line >> d:\user-list.csv
}
05-11 00:58