Solved

Get Mailbox Database Size in GB Exchange 2010 Powershell Command

Posted on 2013-10-31
5
33,387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In this video we show how to create a Distribution Group 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 Recipients >>…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

734 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