Solved

Exchange 2010 Output Powershell Command to CSV

Posted on 2012-03-14
4
1,161 Views
Last Modified: 2012-03-14
I am unable to use the below script and export a usable CSV file.

Get-Mailbox UserAlias | Get-MailboxFolderStatistics | Where {$_.ItemsInFolder -gt 1} | Sort-Object -Property ItemsInFolder -Descending | fl Identity, ItemsInFolder | export-csv c:\transfer\exchangeuserstats.csv

If I remove  '| export-csv c:\transfer\exchangeuserstats.csv' it outputs to the screen fine.

The export to CSV likes like the below.

#TYPE Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
"ClassId2e4f51ef21dd47e99d3c952918aff9cd","pageHeaderEntry","pageFooterEntry","autosizeInfo","shapeInfo","groupingEntry"
"033ecb2bc07a4d43b5ef94ed5a35d280",,,,"Microsoft.PowerShell.Commands.Internal.Format.ListViewHeaderInfo",
"9e210fe47d09416682b841769c78b8a3",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,

How would I use the above command and export a CSV file that lists the folders and ItemsinFolder ?

FYI - Output to screen is typical to the below.
Identity : xxx.lan/Active Users/Hartford/Hartford Users/User Name\Sent Items
ItemsInFolder : 7

Thanks for your assistance.
0
Comment
Question by:fmauri
4 Comments
 
LVL 3

Accepted Solution

by:
LindyS earned 500 total points
ID: 37720272
Try the command like this instead;

Get-Mailbox UserAlias | Get-MailboxFolderStatistics | Where {$_.ItemsInFolder -gt 1} | Sort-Object -Property ItemsInFolder -Descending | Select Identity, ItemsInFolder | export-csv c:\transfer\exchangeuserstats.csv -notype
0
 
LVL 7

Expert Comment

by:d3ath5tar
ID: 37720490
0
 
LVL 2

Expert Comment

by:SieQ
ID: 37720570
LindyS is right,
use select instead of format-list
select Identity, ItemsInFolder - NOT fl Identity, ItemsInFolder
0
 

Author Closing Comment

by:fmauri
ID: 37721102
Worked perfect, thanks for the quick and accurate response.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
A brief introduction to what I consider to be the best editor for PowerShell.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this video we show how to create a mailbox database 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 Servers >> Data…

770 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