Some PowerShell commands will not show all the information

We recently came across on a situation where running a PowerShell command like:

Get-Transportserver | Get-MessageTrackingLog -Start ((get-date)-(new-timespan -days 1)) -End (get-date) -Sender "user@domain.com" | sort Timestamp | ft Timestamp, Sender, MessageSubject, Recipients, ClientIP, ServerIp, RecipientStatus -auto -wrap | out-string -width 4096

Will not show all the results, it will only display a few dots at the end ( ....) instead of the last letters that should show the entire output information.

So the result will look like:

12/03/2010 4:26:46 PM user@domain.com {user@domain.com, user@domain.com user@domain.com, user@domain.com,user@domain.com, user@domain.com}………………………..                     
12/03/2010 4:26:46 PM user@domain.com {user1@domain.com, user2@domain.com,user1@domain.com, user2@domain.com,user1@domain.com, user2@domain.com}…………………….   

Even running the command to place the result in a *.txt file

Get-Transportserver | Get-MessageTrackingLog -Start ((get-date)-(new-timespan -days 1)) -End (get-date) -Sender "user@domain.com" | sort Timestamp | ft Timestamp, Sender, MessageSubject, Recipients, ClientIP, ServerIp, RecipientStatus -auto -wrap | out-string -width 4096 | out-file c:\Results.txt

will not show the whole information, and will only show the same dots like in the PShell, at the end of the columns:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx………

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx………

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx………

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx………

(xxxxxxx –> represents the information that should be displayed and the dots at the end show that the system is unable to display the entire output)

(Changing the –width parameter does not help, it still shows the same dots at the end of the result.)

The best way to see the whole result is to set the parameter “formatenumerationlimit” to -1 which will be considered as unlimited and will display all the information you requested.

(Many thanks to  Iulian Gorodinschi for this info.)

Another way to see this information would be with the LogParser:

The Log Parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.

You just tell the Log Parser what information you need, and how you want it processed. The results of your query can be custom-formatted in text based output, or they can be persisted to more specialty targets like SQL, SYSLOG, or a chart.
The tool can be downloaded from here:

<https://www.microsoft.com/downloads/en/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en>

Comments

  • Anonymous
    December 06, 2010
    It's becasue with Format-Table you removed object and use text. Use Select-Object in pipeline in the place where you have Format-Table. It will work then,

  • Anonymous
    December 10, 2010
    Cool, thanks for the Info David ! I have tested this and it works. Nice tip.. Cheers, Alin