We help IT Professionals succeed at work.

retrieving mailbox stats formatted

Marketing_Insists
on
When I used the below:
Get-MailboxStatistics -database "db1" | fl displayname,storagelimitstatus,totalitemsize,totaldeleteditemsize,database,servername > c:\rpt.txt

I get

storagelimitstatus             : data1
servername                     : data
totaldeleteditemsize           : more-data
displayname                    : some-user 
totalitemsize                  : yada
database                       : bla

storagelimitstatus             : data2
servername                     : data
totaldeleteditemsize           : more-data
displayname                    : some-user 
totalitemsize                  : yada
database                       : bla

storagelimitstatus             : data3
servername                     : data
totaldeleteditemsize           : more-data
displayname                    : some-user 
totalitemsize                  : yada
database                       : bla

etc

Open in new window


How could I get the below?

storagelimitstatus,servername,totaldeleteditemsize,displayname,totalitemsize,database
data1,data,more-data,some-user,yada,bla
data2,data,more-data,some-user2,yada,bla
data3,data,more-data,some-user3,yada,bla
etc

Open in new window

Comment
Watch Question

This must be a trick question :D

Get-MailboxStatistics -database "db1" | fl displayname,storagelimitstatus,totalitemsize,totaldeleteditemsize,database,servername | Export-CSV "C:\export.csv" -NoType

Author

Commented:
Hmms, it just gives me a straight row of GUIDs
Solutions Architect
CERTIFIED EXPERT
Commented:
Chris had it almost right :P you should use the SELECT and not the fl

Get-MailboxStatistics -database "db1" | Select displayname,storagelimitstatus,totalitemsize,totaldeleteditemsize,database,servername | Export-csv c:\rpt.csv

Author

Commented:
Thanks!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.