Get-MailboxStatistics with TotalItemSize in MB to a CSV file

Just ignore this, I wanted to store this code snippet somewhere and this was the best place.  But if you are interested this will create a csv file from Get-MailboxStatistics, but with the TotalItemSize in MB

“DisplayName,TotalItemSize(MB),ItemCount,StorageLimitSize,Database,LegacyDN” | out-file GMS.csv; get-mailbox -resultsize unlimited | Get-MailboxStatistics | ForEach{$a = $_.DisplayName;$b=$_.TotalItemSize.Value.ToMB();$c=$_.itemcount;$d=$_.storagelimitstatus;$e=$_.database;$f=$_.legacydn;”$a,$b,$c,$d,$e,$f”} | out-file GMS.csv -Append

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.