Solved

Exchange 2010 Output Powershell Command to CSV

Posted on 2012-03-14
4
1,138 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

757 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