Change powershell script to output without ellipses (…)

前端 未结 3 1376
野的像风
野的像风 2021-02-01 03:19

I need some help with the output of the following script so the output doesn\'t show with the ellipses (...). I tried to insert | Format-Table -Wrap -AutoSize but I

3条回答
  •  醉话见心
    2021-02-01 04:19

    I came across this post and would like to add some information, as the accepted solution did not resolve my problem and I'm sure others may find the following information useful:

    Quick Story: Running commands using Microsoft Online Services Module with Powershell, much of the results were continually be retrieved as truncated with data cutoff and missing as an ellipsis (...).

    The fix: As explained in this post by Greig, I inevitably came to the conclusion $FormatEnumerationLimit=-1 is the unlimate solution to the problem. Using any variant of Format-Wide, Format-List, Format-Table, Format-Custom, -AutoSize, Out-String -Width, etc. require a hefty amount of additional considerations/code. In the case where all you want is to see all the data being returned, regardless of columns, arrays, etc., $FormatEnumerationLimit=-1 ensures you will get everything and you don't need to mess around.

    Additional information, as credited in Greig's post include:

    PowerShell Quick Tip: Creating wide tables with PowerShell, where the author explains:

    If you have a specific property that contains a collection of items, that property may still show an ellipsis in the file produced here if the number of items in that collection exceeds the number assigned to the built-in $FormatEnumerationLimit variable.

    ...and that "passing the results to | Format-Table -Property * [will] show all of the columns." But content from the columns may still be truncated ("PowerShell truncates table output by default"), and that even using | Format-Table -Property * -AutoSize will be limited by your screen buffer ("Auto-sized tables are limited to the width of your screen buffer"). The solution offered, before the absolute $FormatEnumerationLimit=-1, seems to be using | Format-Table -Property * -AutoSize in conjunction with | Out-String -Width 4096 or whatever width you require.

    Using Format Commands to Change Output View provides some more delailed documentation on the Format cmdlets: Format-Wide, Format-List, and Format-Table.

提交回复
热议问题