Solved

Get Mailbox Database Size in GB Exchange 2010 Powershell Command

Posted on 2013-10-31
5
29,761 Views
Last Modified: 2013-11-01
I presently get my Exchange database statistics using the following command:

Get-MailboxDatabase -Status | Select-Object Name,DatabaseSize,AvailableNewMailboxSpace | Sort-Object Name | fl

Now that my database are over 1TB in size, and I provide my reports in GB, I have to manually convert the TB to GB (in this case I use Google)

Is there a way to have the output on the DatabaseSize ONLY, given in GB.

I do not want the AvailableNewMailboxSpace output modified, as it does a good job providing it in either GB or MB, depending on the size.

Thank you.
0
Comment
Question by:fireguy1125
  • 2
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 39614358
Simple method is to create a custom property..

@{N="DatabaseSize GB";E={$_.DatabaseSize.ToGB()}}


For example..
Get-MailboxDatabase -Status | Select-Object Name,@{N="DatabaseSize GB";E={$_.DatabaseSize.ToGB()}},AvailableNewMailboxSpace | Sort-Object Name | fl

Open in new window

0
 
LVL 8

Expert Comment

by:EEhotline
ID: 39614548
These are the 2 commands I usually use:

To GB: get-mailbox | Get-MailboxStatistics | Select-Object DisplayName, {$_.TotalItemSize.Value.ToGB()}, DatabaseName | export-csv U:\mbreport.csv

To MB: get-mailbox | Get-MailboxStatistics | Select-Object DisplayName, {$_.TotalItemSize.Value.ToMB()}, DatabaseName | export-csv U:\mbreport.csv

For more details, I use this:

get-mailbox | Get-MailboxStatistics | Select-Object DisplayName, {$_.TotalItemSize.Value.ToMB()}, ItemCount, DatabaseName | export-csv C:\mbreportmb.csv

Hope it helps,
0
 
LVL 1

Author Comment

by:fireguy1125
ID: 39614588
Subsun, your report is what i'm looking for:

-Is there any way to have the Gb results to 2 decimal places? Such as: 1220.35
-Is there any way to have the result include the 'GB', as it just displays the number now, can we have the 'GB' appended to the result (only because it adds an extra step for me to do)

Thanks!
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39614637
Try..
Get-MailboxDatabase -Status | Select-Object Name,@{N="DatabaseSize GB";E={"$([math]::round($_.DatabaseSize.Tobytes() /1Gb, 2)) GB"}},AvailableNewMailboxSpace | Sort-Object Name | fl

Open in new window

0
 
LVL 1

Author Closing Comment

by:fireguy1125
ID: 39616539
Perfect exactly what I need, thanks!
0

Featured Post

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a mailbox database 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 Servers >> Data…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now