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= $a.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

Source:  https://social.technet.microsoft.com/Forums/exchange/en-us/56ac5fc7-0115-4506-89fd-30b859301b2b/exchange-powershell-script-to-find-all-users-mailbox-sizes?forum=exchange2010
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

0 comments:

Post a Comment

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