How to Export Results from Exchange Management Shell Without Truncating Data

Recently I was using the Exchange Management Shell to generate a .csv file from the Message Tracking Logs. Unfortunately, the output in the .csv file was truncated as the command shell has a default width of 120 characters. This led to truncated data, which wasn’t going to do me any good. So I used two PowerShell cmdlets to format the results into an Excel-friendly format without truncating the data, Format-Table and Out-String.

You can read more about both of these cmdlets below of them using the links below:



As an example, I’ll use the get-MessageTrackingLog command to export a list of Delivery Status Notifications to a .csv file.

get-MessageTrackingLog -Server "MailboxServer01" -EventID "DSN" -Start "9/24/2011 5:00:00 AM" -End "9/24/2011 6:00:00 AM" -ResultSize Unlimited | Format-Table -AutoSize | Out-String -Width 20000 > c:\DSN_09242011.csv

Adding those two cmdlets generated the expected results, which I was able to easily import and manipulate in Excel.

About Rebecca Harness

Rebecca Harness is a Business Information Security Officer (BISO) for a publicly-traded, global information solutions company. As BISO, she champions security initiatives and recommends strategies to mitigate risk, facilitating innovation and new product development. She’s also responsible for representing the business unit’s security program in client facing engagements, conferences, and industry forums. Prior to her current role, she was an influential cybersecurity leader for one of the world’s largest transportation providers, known for transforming information security efforts into well-orchestrated programs. There, she developed an innovative methodology for delivering key information security priorities as a service model, leading to quicker adoption enterprise-wide while significantly reducing operational costs. She also led and modernized their global, multi-brand PCI Assessment and other compliance initiatives. In the early 2000’s, Rebecca developed one of St. Louis' leading Managed Services Providers from a startup in a spare bedroom into a mature consulting company with 30+ employees and 150+ clients in the Greater St. Louis Area. Rebecca holds many certifications, including; ISACA Certified Information Systems Auditor (CISA); ISC2 Certified Information Systems Security Professional (CISSP); and GIAC Security Leadership Certified (GSLC). She’s also a proud alumni of Hastings College and a longtime member of the Society of American Magicians.

One Response to “How to Export Results from Exchange Management Shell Without Truncating Data”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s