May 16, 2012 - Warren Held

PowerShell: Prevent Output From Being Cut Off & Export To Excel File

Recently I have been using PowerShell to administer our hosted Exchange Online. When I would run a command that would return a list of information I was getting truncated lines that would cut off some of the info. It would look something like this: “FConferenceRoom@n… NAMPRD04\Domain A… {FullAccess}”. I have found two ways so far to make PowerShell spill the beans. You can pipe the ouput to Format-Table or Format-List. Follow the two example commands below (the | is the symbol for pipe):

You can abbreviate Format-Table and Format-List as ft and fl. The -autosize on the Format-Table will output everything in table form, but expand the width of the columns so things don’t get truncated.

You can also export the output into a csv file, which can then be opened by Excel or another spreadsheet application. To do this simply pipe the output to the export-csv cmdlet. Example:


PowerShell PowerShell /