TotalItemSize.Value.ToMB()}} -Auto
This produces the result shown in Figure 16 - 9 .
There is promise here. You have a readable number and a nice ordered list, however the title of
the converted column is pretty ugly. You can assign a different label to a value column when using
Format-Table by adding a semicolon, the keyword label, and then the new name. The following
example shows how to change the label to TotalItemSizeMB , however any suitable title can be chosen:
Format-Table DisplayName, @{expression =
{$_.TotalItemSize.Value.ToMB()};label=???TotalItemSizeMB???} -Auto
Now you have a final report. To save this so that you can review it later or send it to others you should
pipe this data out to a file. You can do this by using the Out-File cmdlet as was discussed earlier in
this chapter:
out-file C:\Data\MailboxReport.txt
Chapter 16: Reporting, Maintenance, and Administration
479
The final script when added together looks like this:
get-MailboxStatistics | where-object
{???IssueWarning???,???ProhibitSend???,???MailboxDisabled???,???NoChecking??? -contains
$_.StorageLimitStatus} | sort-object StorageLimitStatus, TotalItemSize | formattable
DisplayName, StorageLimitStatus,
@{expression={$_.TotalItemSize.Value.ToMB()};label=???TotalItemSize(MB)???} | out-file
-filepath C:\data\MailboxReport.
Pages:
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666