chadkline
asked on
Exchange Management Shell Error
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={$_.totalitem size.value .ToMB()};l abel=”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
Here is what I am entering:
Get-MailboxStatistics -Database “Mailbox Database” | Sort -Property TotalItemsize | Format-Table DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitem
It displays correctly in the shell, but the output is distorted and looks like below attachment.
Any help would be appreciated.
mail.JPG
ASKER
Thanks. I will try it out in the morning.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Please explain your solution sunnyc7
I just modified your script
ASKER
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?
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?
ASKER
Okay, here is what I did. I removed the Format Table and added Select:
Get-MailboxStatistics -Database “Mailbox Database” | Select DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitem size.value .ToMB()};l abel=”Size (MB)”}, LastLogonTime, LastLogoffTime | Export-CSV c:\mailboxes2.csv
I got the results i wanted and in separate columns in the csv.
Get-MailboxStatistics -Database “Mailbox Database” | Select DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitem
I got the results i wanted and in separate columns in the csv.
nice :)
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