KirkMunro / FormatPx

Better Formatting in PowerShell
Apache License 2.0
73 stars 5 forks source link

Question on format-table... getting format-list output #6

Open kduerr opened 8 years ago

kduerr commented 8 years ago

Kirk,

First - Thanks for the module! I have a question, don't know if it is an issue or pilot error.

I have another module I use which imports FormatPX, I had noticed a format issue when I ran my code in a new PS window for the first time (did not have the issue on a second run in the same window). I trimmed my code to this to reproduce it.

My problem: When I do a format-table on the object (test #1), it displays as expected, after I load the FormatPX and do the same format-table (test #2), I get a format-list output instead of format-table.

==code-sample================== $menuObj = @( [pscustomobject]@{choice="1";labelx="x";function="Function #1";desc="Description...1"; status="x"}, [pscustomobject]@{choice="2";labelx="x";function="Function #2";desc="Description...2"; status="x"} )

write-host "nn Test #1 " $menuObj |Format-Table

Import-Module FormatPX (Get-Module FormatPX).Version

write-host "nn Test #2 "

$menuObj |Format-Table

Execution of script output: PS C:\Users\Administrator\OneView-shell> .\test.ps1

Test #1

choice labelx function desc status


1 x Function #1 Description...1 x 2 x Function #2 Description...2 x

Major Minor Build Revision


1 1 3 15

Test #2

choice : 1 labelx : x function : Function #1 desc : Description...1 status : x

choice : 2 labelx : x function : Function #2 desc : Description...2 status : x

PS C:\Users\Administrator\OneView-shell>

Additional info PS C:\Users\Administrator\OneView-shell> $PSVersionTable

Name Value


PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.17929 BuildVersion 6.3.9600.16406 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2

Thanks -Kelly

Verayth commented 6 years ago

I've noticed this same problem when using FormatPx in PS scripts run from Jenkins. The only solution I've found was to import the module in my $PROFILE. Without this work-around, ALL output acts like I've just done a "Select-Object *".