#1 01 Apr 2019 20:49

xcabur
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
}

Test-A

$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

Offline

Board footer

Powered by FluxBB