Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powershell to calculate amount of space used in a database

Posted on 2010-09-03
4
Medium Priority
?
406 Views
Last Modified: 2012-05-10
Hi there,

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

Tacobell
0
Comment
Question by:Tacobell2000
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

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

Change KB to MB for megabyte display or GB to gigabyte..
0
 
LVL 10

Accepted Solution

by:
jorlando66 earned 2000 total points
ID: 33598545
Get-MailboxStatistics | Sort-Object TotalItemSize –Descending | ft DisplayName,@{ expression={$_.TotalItemSize.Value.ToKB()}},ItemCount >>c:\mail.txt

Will pipe the results to c:\mail.txt
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33598686
do you want to include the deleted item retention
this breaks it down by mailbox with both
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33598709
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 }
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
Mailbox Corruption is a nightmare every Exchange DBA wishes he never has. Recovering from it can be super-hectic if not entirely futile. And though techniques like the New-MailboxRepairRequest cmdlet have been designed to help with fixing minor corr…
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question