Exchange powershell script to find all users mailbox sizes

This Powershell script will give you the size of all user's mailboxes. Save this to a .ps1 and run it

Get-MailboxStatistics -Server 'SERVERNAME' | where {$_.ObjectClass -eq “Mailbox”} | Sort-Object TotalItemSize -Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}}  -auto >> “c:\Temp\mailbox_size.txt”
# Set the current date
$a = get-date
$month= $a.month
$day= $
$year= $a.year
# File variables
$location = "c:\temp"
$BASE = "mailbox_size.txt"
$filename = $location+"$month"+"-"+"$day"+"-"+"$year"+"-"+$BASE
$oldfile = $Location+$BASE
# Rename file for current date
rename-item $oldfile $filename

Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment


Post a Comment

Note: Only a member of this blog may post a comment.