Solved

Get Mailbox Database Size in GB Exchange 2010 Powershell Command

Posted on 2013-10-31
5
31,319 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

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…
Read this checklist to learn more about the 15 things you should never include in an email signature.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
To show how to create a transport rule 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 Mail Flow >> Rules tab.:  To cr…

831 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