Link to home
Start Free TrialLog in
Avatar of abustraan
abustraan

asked on

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

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...
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your don't write | convertto-csv | out-file, it's just | export-csv