1:查看详细的登陆情况和使用容量
Get-MailboxStatistics -Server dex01.tiptop.com | Sort LastLogonTime -Descending | Export-CSV d:\l.csv
2:Get-MailboxStatistics -Database "Mailbox Database"
3:搜集排名前1000的用户容量,在数据库DB100中,导出HTML格式。如果–server dex01.tiptop.com 省略,则查询所有的mailbox server
Get-Mailbox
–server dex01.tiptop.com | Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name="MailboxSize";exp={$_.totalitemsize}} -first 10000 | Convertto-Html | out-File d:\report.html
//-database是指定数据库 DB100是数据库名字
如果是-server 则后面带服务器名字,如-server dex02,如果
–server dex01.tiptop.com 省略,则查询所有的mailbox server
//DisplayName,ItemCount ,这些是类,可以添加相应的类在中间,用,隔开
将以上信息邮件传送出来
$body = get-content d:\report.htm | out-string
Send-Mailmessage -from thiyagu.p@fox.com -to thiyagu.p@fox.com -subject "Top 10 Mailboxes by Size" -smtpserver fox-ex1 -body $body –bodyasHTML
4:例如一个完整的脚本,搜集用户容量前1000的用户,然后邮件发送至指定的邮箱的PS1脚本为
Get-Mailbox
–server dex01.tiptop.com | Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name="MailboxSize";exp={$_.totalitemsize}} -first 10000 | Convertto-Html | out-File d:\report.html
$body = get-content
d:\report.htm | out-string
Send-Mailmessage -from
thiyagu.p@fox.com -to
thiyagu.p@fox.com -subject "Top 10 Mailboxes by Size" -smtpserver
fox-ex1 -body $body –bodyasHTML
5:搜集VIP数据库中的用户使用情况,导出到CVS
Get-MailboxStatistics -database "vip"| select DisplayName, ItemCount, TotalItemSize,LastLoggedOnUserAccount,LastLogonTime,ServerName,DatabaseName | Export-CSV d:\l.csv
6:打印一些类
Get-MailboxStatistics -database "vip" |Format-table DisplayName,TotalItemSize,LastLoggedOnUserAccount,LastLogonTime,ServerName,DatabaseName >d:\1.txt
7:check database SIZE
Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize >d:\x.txt
8:列举服务器的邮箱数目
Get-Mailbox –ResultSize unlimited | Group-Object –Property:ServerName | Select Name,Count
9:检查mailbox database情况
Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize | Convertto-Html | out-File d:\report\MailBox.html
$body = get-content d:\report\MailBox.html | out-string
Send-Mailmessage -from postmail@tiptopgroup.cn -to its@tiptopgroup.cn -subject " Mailboxes Size check" -smtpserver mail.tiptop.com -body $body –bodyasHTML
//检查MAILBOX容量并通过POSTMAIL发送至特定的邮箱。