#1 01 Apr 2019 20:49

New Member
Registered: 23 Oct 2018
Posts: 4

Change default output to format-list

Hi, i have a simple function like this:

function Test-A{
    $out = [pscustomobject]@{
        Name = "Test"
        Value  = "1"
        Value1  = "1"
        Value2  = "1"


$out is formatted as a table by default. But I prefer the list format.  Also the output should follow the pipline unformatted for further processing. I can't use $out | fl, because the output format should be affected from outside the function. E.g. test-a | ft or test-a | out-gridview. This would be in conflict with fl within the function.
If there are more than five properties, the output automatically changes to list form. However, I have fewer properties. Can I change the default output format to the list format myself?

thanks a lot

best regards


#2 26 Sep 2020 15:40

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,118

Re: Change default output to format-list

Here's a worked example of setting the Default Property Display
https://learn-powershell.net/2013/08/03 … m-objects/


Board footer

Powered by FluxBB