Tuesday, 28 May 2013

Eliminate Ellipsis In Powershell


When trying to display the result of some queries on screen, we may find that some of the output is truncated by ellipsis i.e. “ . . .” , often the case with multi-valued attributes. An example of the ellipsis can be found when retrieving the thread details of any process. The image below shows the output when querying the thread details for system process:

Get-Process System | select Name,Threads




The reason that the thread column gets truncated at 4 values is because of $FormatEnumerationLimit. Help about the variable can be found under About_Preference_Variables. The value is set at 4 by default in the powershell console and the value is 16 in the exchange shell.











The entire thread details can be listed by modifying the above command to:

Get-Process System | select Name,Threads | ft –Wrap –Autosize



An alternate method to display the threads would be to use the ‘ExpandProperty’ switch in Select-Object cmdlet:

get-process system | Select-Object Name -ExpandProperty Threads | ft Name, ID –AutoSize




The easiest method would be to change the default value of the $FormatEnumerationLimit.

The default value has been altered to 80 which displays the whole list of system threads on screen:



No comments:

Post a Comment