title: How to get all Exchange mailboxes sizes and extract to excel using exchange shell commands?
body: <p>I am running the below code to get all mailboxes sizes:</p>
  <pre><code>Get-MailboxStatistics -Server 583606-exchange| Sort-Object TotalItemSize -Descending | ft DisplayName,@{label=&quot;TotalItemSize(GB)&quot;;expression={&quot;$([math]::round($_.TotalItemSize.Value.ToBytes() /1Gb, 2)) GB&quot;}} ,ItemCount  -auto 
  </code></pre>
  <p>This is the output:</p>
  <blockquote>
  <p>DisplayName___TotalItemSize(GB)___ItemCount</p>
  <p>User1_________14.71 GB__________83000</p>
  <p>User2__________3.98 GB__________7600</p>
  </blockquote>
  <p>Now if I need to export the output to excel using the below code:</p>
  <pre><code>Get-MailboxStatistics -Server servername| Sort-Object TotalItemSize -Descending | ft DisplayName,@{label=&quot;TotalItemSize(GB)&quot;;expression={&quot;$([math]::round($_.TotalItemSize.Value.ToBytes() /1Gb, 2)) GB&quot;}} ,ItemCount  -auto | export-csv C:\Scripts\UserMailboxSizes.csv
  </code></pre>
  <p>it's exporting but no data in there.</p>
  <p>Can you please let me know what I am missing?</p>
  <p>Thanks in advance :)
  Yousry</p>