formatting Get-MailboxStatistics output

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 5 months ago.

  • Author
    Posts
  • #6513

    by PS-MAX at 2013-02-11 04:33:38

    Hi,i wrote a ps script that will send me weekly a overview of my mailbox sizes.

    that's my command:
    Get-MailboxStatistics -DataBase MYDATABASE | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount,StorageLimitStatus

    All works fine but the output shows not the complete DisplayName

    For Example the output for Mailbox Archives:

    DisplayName TotalItemSize(MB) ItemCount StorageLimitStatus
    ----------- ----------------- --------- ------------------
    Personal Archive... 16946 72937 BelowLimit
    Personal Archive... 16832 71528 BelowLimit
    Personal Archive... 14294 44922 BelowLimit
    Personal Archive... 12737 13950 BelowLimit
    Personal Archive... 12118 36644 BelowLimit

    How can i configure to see the complete DisplayName of a mailbox?

    thx
    Max

    by IfiokM at 2013-02-11 06:33:15

    try using -autosize switch with Format-Table (FT).

    by Takuu at 2013-02-11 06:53:54

    when I run into this issue, I run into issues because of the width of the buffer/window size in the settings for Powershell. Just adding the -autosize parameter on your format-table cmdlet might work for you, depending on the length of the displayname property.

    Here is what I found works, given that your displayname property might still be cut off due to length:

    add the -autosize parameter, then pipe the result to Out-File and specify a -width that works (600 should be more than enough). You then have a tab delimited txt file that you can work with.

    Get-MailboxStatistics -DataBase MYDATABASE |
    Sort-Object TotalItemSize -Descending |
    ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount,StorageLimitStatus -autosize |
    Out-File C:\temp\results.txt -width 600

    **edited first to put each pipe on a separate line**
    **edited again for this: using format-table like I did above isn't recommended, as you now have a powershell table formatted object. I believe using select-object instead should be used if you are not using format-table as the last object in a PS command. The above, however, does work. **

    by PS-MAX at 2013-02-12 02:17:20

    Hi,

    thx foor that.
    -autosize works fine for me

You must be logged in to reply to this topic.