[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Exchange 2013 Mailbox Size in GB with 2 decimals Export to CSV via Exchange PowerShell

Posted on 2015-01-11
3
Medium Priority
?
456 Views
Last Modified: 2015-01-28
I have this code:
set-executionpolicy RemoteSigned
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
(Get-MailboxDatabase | get-mailboxstatistics | Sort-object totalitemsize -descending | select-object displayname, itemcount, @{ expression={$_.TotalItemSize.Value.ToGB()} } | convertto-csv | out-file "E:\Exports\$(get-date -format yyyy-MM-dd_hhmmss)_MBSize.csv")

Open in new window


And it runs great with the exception I can't seem to get the output to GB with 2 decimals. I've tried merging parts and pieces, trying to keep it a simple script without a bunch of variables...
0
Comment
Question by:abustraan
[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
3 Comments
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 1000 total points
ID: 40543320
Take a look at this PAQ which will assit with the 2 decimal places.

Powershell 2 decimail places

Try removing the -descending for the script and run it again. When I did it without descending it worked for me.

Also, because you are exporting to a csv you can just sort the TotalItemSize column manually, as you already know.

Will.
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 1000 total points
ID: 40543322
This might work for you?
(Get-MailboxDatabase | get-mailboxstatistics | Sort-object totalitemsize -descending | select-object displayname, itemcount, @{ expression={$_.TotalItemSize.Value / 1GB};formatstring='N2' } | convertto-csv | out-file "E:\Exports\$(get-date -format yyyy-MM-dd_hhmmss)_MBSize.csv")

Open in new window

0
 
LVL 71

Expert Comment

by:Qlemo
ID: 40543378
Your don't write | convertto-csv | out-file, it's just | export-csv
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
One-stop solution for Exchange Administrators to address all MS Exchange Server issues, which is known by the name of Stellar Exchange Toolkit.
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 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…
Suggested Courses

656 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