Add -FormatEnumerationLimit parameter to Format-List and Format-Table
See original GitHub issueSummary of the new feature / enhancement
With PowerShell, you sometimes get objects which have properties that are actually an array of objects. The Threads and Modules Properties on System.Diagnostics.Process object. When Format-List/Format-Table formats these parameters, they only include up to a certain number of occurrences, by default 4. The number of enumerations shown is determined by the automatic variable $FormatEnumerationLimit. So if you want more, you just update that variable, typically in a $Profile.
Here is the current behaviour:
PS> $FormatEnumerationLimit
4
PS> Get-Process | Select-Object -Property Name, Threads -First 4
Name Threads
---- -------
AggregatorHost {5240}
ApplicationFrameHost {16968, 2848, 18728}
AppVShNotify {9164}
Atom.SDK.WindowsService {4064, 4908, 4912, 19144…}
PS> $FormatEnumerationLimit = 1
PS> Get-Process | Select-Object -Property Name, Threads -First 4
Name Threads
---- -------
AggregatorHost {5240}
ApplicationFrameHost {16968…}
AppVShNotify {9164}
Atom.SDK.WindowsService {4064…}
I propose adding a new parameter to both Format-List and Format-Table, -FormatEnumerationLimit which overrdes the value of $FormatEnumerationLimit, but just for this command. Like this:
PS> Get-Process | Select-Object -First 4 | Format-Table Name, Threads -FormatEnumerationLimit 2
Name Threads
---- -------
AggregatorHost {5240}
ApplicationFrameHost {16968, 2848…}
AppVShNotify {9164}
Atom.SDK.WindowsService {4064, 4908…}
Proposed technical implementation details (optional)
- Update each cmdlet with the extra parameter
- Change the logic for handling enumeration limit by using the parameter value if it is specified.
- Retain the default value and default variable handling.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:22 (8 by maintainers)
Top Results From Across the Web
How to Use $FormatEnumerationLimit - PowerShell ...
The trick is to use the $FormatEnumerationLimit variable and assign it a higher value.
Read more >Change $FormatEnumerationLimit
When I'm working in the PowerShell Console by default when using Format-List you see the data returned cut off. This can be annoying!...
Read more >How can I store output from Format-Table for later use
I have a script that creates several jobs and stores two simple values in the jobs. Start-Job -ScriptBlock {param ([string]$compip) tnc $compip ...
Read more >Tag: Format-Table
Posts about Format-Table written by Kirk Munro. ... Here is what happens if you add the AutoSize parameter to the same command you...
Read more >Formatting objects in PowerShell with Format-Custom, ...
The Format-List cmdlet formats the output of a command as a list of properties, showing each property on a new line. This cmdlet...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Given that this proposal is limited to the
Format-List|Table
commands,Format
in the parameter name seems redundant. You could shorten the parameter name to-EnumerationLimit
.