经常我们做服务比较尴尬的事情是在于客户对于一些需求很难有明确的把握,比如有些客户需要得出一些mailbox属性,结果他后面又要MAILBOXSTATIcs属性,这样的话我们就很难把握具体客户的想法。但是Powershell 脚本是个好东东,可以达到满足客户需求的效果,我们可以使用以下的脚本来达到预订的效果:
Get-Mailbox –Database SRV1\SG01\DB01 Select-Object name,primarysmtpaddress,DisplayName,Database,@{n="Size(MB)";e = {$MBXstat = Get-MailboxStatistics $_.name; $MBXstat.totalItemsize.value.toMB()}},@{n="Items"; e = {$MBXstat = Get-MailboxStatistics $_.name ; $MBXstat.itemcount}}
以下为参考文档:
1. Return result on both Get-Mailbox, and Get-MailboxStatistics
http://social.technet.microsoft.com/Forums/ar/winserverpowershell/thread/49ce234a-6038-4209-9965-631b0da980b3
2. Combining two commands get-mailbox and get-mailboxstatistics
http://get-exchange.blogspot.com/2009/03/did-you-ever-needed-to-supply-list-of.html
3. Two commands get-mailbox and get-mailboxstatistics
http://www.testlabs.se/blog/2012/03/06/selected-powershell-commands-output-to-csv-file/