a question powershell output formatting

This topic contains 4 replies, has 2 voices, and was last updated by Profile photo of Garegin Asatryan Garegin Asatryan 2 years, 2 months ago.

  • Author
    Posts
  • #19369
    Profile photo of Garegin Asatryan
    Garegin Asatryan
    Participant

    I understand that you can format output by using -autosize -wrap, fl, ft and various other methods. However I'm a little confused about formatting columns so I can see all the output. When I run gv PSVersionTable | ft -wrap the output it still cutoff with a ...
    I know I can run $psversiontable, but I want to know why gv Error | ft -wrap wraps the text properly but gv PSVersionTable | ft -wrap does not.

  • #19372
    Profile photo of Don Jones
    Don Jones
    Keymaster

    It depends on the object. Some object types have pre-defined formatting instructions provided by Microsoft, and their formatting will reflect that default unless you do something completely custom – e.g., define each output column yourself.

  • #19390
    Profile photo of Garegin Asatryan
    Garegin Asatryan
    Participant

    [blockquote]define each output column yourself. [/blockquote]

    and how would you to that.

  • #19414
    Profile photo of Don Jones
    Don Jones
    Keymaster
    Get-Something | Format-Table ColumnA,ColumnB,@{n='ColumnC';expression={ $_.PropC / 1GB };width=10;align='right';formatString='N2'}

    As an example. There are other examples in the help for Format-Table. The point is, when you list out the columns yourself – whether you create custom ones or not, as I've done with ColumnC in my example – the default formatting doesn't apply.

  • #19421
    Profile photo of Garegin Asatryan
    Garegin Asatryan
    Participant

    capisce.

You must be logged in to reply to this topic.