Link to home
Start Free TrialLog in
Avatar of Tacobell2000
Tacobell2000Flag for Canada

asked on

Powershell to calculate amount of space used in a database

Hi there,

I need a script that will calculate the amount of space each person is using in Exchange 2007. In MB please.

Tacobell
Avatar of jorlando66
jorlando66
Flag of United States of America image

Get-MailboxStatistics | Sort-Object TotalItemSize –Descending | ft DisplayName,@{ expression={$_.TotalItemSize.Value.ToKB()}},ItemCount

Change KB to MB for megabyte display or GB to gigabyte..
ASKER CERTIFIED SOLUTION
Avatar of jorlando66
jorlando66
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
do you want to include the deleted item retention
this breaks it down by mailbox with both
it erased my code

Get-Mailbox | ForEach-Object { $stats = Get-MailboxStatistics $_.Name ;
$size = $stats.totalitemsize.value.tomb() + $stats.totaldeleteditemsize.value.tomb();
write-host $stats.displayname $size }