Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exchange 2010 Output Powershell Command to CSV

Posted on 2012-03-14
4
Medium Priority
?
1,208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
LindyS earned 2000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

721 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