Solved

Exchange Management Shell Error

Posted on 2010-08-30
8
422 Views
Last Modified: 2012-05-10
Trying to produce a report using Exchange Management Shell for mailbox statistics.

Here is what I am entering:

Get-MailboxStatistics -Database “Mailbox Database” | Sort -Property TotalItemsize | Format-Table DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label=”Size(MB)”}, LastLogonTime, LastLogoffTime | Export-CSV c:\mailboxes.csv

It displays correctly in the shell, but the output is distorted and looks like below attachment.

Any help would be appreciated.



mail.JPG
0
Comment
Question by:chadkline
  • 4
  • 3
8 Comments
 
LVL 6

Expert Comment

by:craig_j_Lawrence
ID: 33563307
If you remove the format-table section, it should export to csv properly. As you have discovered, format-table is for on screen display, not for exporting to a file

Take a look at the 'one-liner' in the link, should guide you in the right direction: http://powershell.com/cs/media/p/1668.aspx

and this one show how to manipulate the data

http://aspoc.net/archives/2007/11/07/convert-the-get-mailboxstatistics-output-from-bytes-to-mb-or-gb-in-exchange-2007/

Hope this helps
Craig
0
 

Author Comment

by:chadkline
ID: 33563348
Thanks. I will try it out in the morning.
0
 
LVL 28

Accepted Solution

by:
sunnyc7 earned 500 total points
ID: 33563843
Get-MailboxStatistics -Database “Mailbox Database” | Sort -Property TotalItemsize | Format-Table DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label=”Size(MB)”}, LastLogonTime, LastLogoffTime > c:\mailboxes.csv
0
 

Author Comment

by:chadkline
ID: 33563902
Please explain your solution sunnyc7
0
Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

 
LVL 28

Expert Comment

by:sunnyc7
ID: 33565958
I just modified your script
0
 

Author Comment

by:chadkline
ID: 33567772
sunnyc7,

Your output is exactly what I want, however, when I open the csv file, all of the columns are in one cell.
How can this be corrected?
0
 

Author Comment

by:chadkline
ID: 33568033
Okay, here is what I did. I removed the Format Table and added Select:

Get-MailboxStatistics -Database “Mailbox Database” | Select DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label=”Size(MB)”}, LastLogonTime, LastLogoffTime | Export-CSV c:\mailboxes2.csv

I got the results i wanted and in separate columns in the csv.
0
 
LVL 28

Expert Comment

by:sunnyc7
ID: 33568058
nice :)
0

Featured Post

Why spend so long doing email signature updates?

Do you spend loads of your time carrying out email signature updates? Not very interesting are they? Don’t let signature updates get you down. Let Exclaimer Cloud - Signatures for Office 365 make managing email signatures a breeze.

Join & Write a Comment

Easy CSR creation in Exchange 2007,2010 and 2013
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now