[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Exchange 2010 PowerShell Export to CSV Error

Posted on 2012-08-12
Medium Priority
Last Modified: 2012-08-12
I'm trying to run a report of mailboxes sizes in a database to export to a csv file, however when I run it, the results in the csv file appear as:

#TYPE Microsoft.PowerShell.Commands.Internal.Format.FormatStartData

The command I'm using is:

Get-Mailbox -database "DB04" | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount | Export-CSV C:\Users\Administrator.DOMAIN\Desktop\mailboxessize.csv

Thank you for your assistance in advance.
Question by:fireguy1125
LVL 13

Assisted Solution

Xaelian earned 1000 total points
ID: 38285992
Here you go. This is what I use. Enjoy.

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName, IssueWarningQuota, ProhibitSendQuota, @{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics$_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database | Export-Csv"C:\Scripts\UserMailboxSizes.csv" -NoTypeInformation
LVL 71

Accepted Solution

Qlemo earned 1000 total points
ID: 38286075
You should use format-* only for screen output, or if you want a similar formatted content in text files. As a rule of thumb, format-* is always the last command in a pipe.
Why? Because it destroys any additional information about the piped objects, transforming all properties into a single line consisting of strings.

In this particular case you should replace the ft with select-object to get the expected result. You migth want to add the -NoTypeInformation switch to Expert-CSV to skip the type information (#TYPE ...), which is thought to be used for Import-CSV.

Featured Post

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

Question has a verified solution.

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

This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
If you have come across a situation where you need to find some EDB mailbox recovery techniques, then here you will find the same. In this article, we will take you through three techniques using which you will be able to perform EDB recovery. You …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses

873 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