?
Solved

Get Mailbox Database Size in GB Exchange 2010 Powershell Command

Posted on 2013-10-31
5
Medium Priority
?
35,646 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 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
To show how to generate a certificate request 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 >> Certificates…
how to add IIS SMTP to handle application/Scanner relays into office 365.
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 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