Exchange Powershell mailboxes statistics

Hi folks,

have a command:

Open in new window

Get-mailboxstatistics  -Database bronze -DomainController | Where  {$_.DisconnectDate -ne $null} |  select DisplayName,TotalItemSize,TotalDeletedItemSize | export-csv c:\powershell\mailboxstatistics.csv

Open in new window

What can I do columns  TotalItemSize and TotalDeletedItemSize gave values, expressed in gigabytes?
Who is Participating?
Sudhir BidyeConnect With a Mentor Commented:
Get-Mailbox -Server ExchangeServerName | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,@{Label="Size(Gb)"; Expression={$_.TotalItemSize.Value.ToGb()}} | ft -auto
Miguel Angel Perez MuñozCommented:
try this:
Get-mailboxstatistics  -Database bronze -DomainController | Where  {$_.DisconnectDate -ne $null} |  select DisplayName,TotalItemSize,TotalDeletedItemSize | ForEach-Object {$_.totalitemsize / 1GB -and $_.totaldeleteditemsize / 1Gb} | export-csv c:\powershell\mailboxstatistics.csv
nesher13Author Commented:
Miguel Angel Perez Muñoz

It does not work.
Will SzymkowskiSenior Solution ArchitectCommented:
You can also accomplish this using the below syntax.

Get-mailboxstatistics  -Database bronze -DomainController | Where  {$_.DisconnectDate -ne $null} |  select DisplayName,@{Label="Total Item Size /GB";expression={[int]($_.TotalItemSize/1GB)}}, @{Label="Total Deleted Item Size /GB";expression={[int]($_.TotalDeletedItemSize/1GB)}} | export-csv c:\powershell\mailboxstatistics.csv -notypeinformation

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.