Viewing Truncated PowerShell Output

Sometimes PowerShell truncates output, and if you don’t realise what’s going on, you’ll never get it to show.

Where you’re expecting potentially lots more text, PowerShell replaces it with a single lousy ellipsis, cruelly taunting you.

Column Width

If it’s just a column width problem, the fix is simple enough: just pipe to out-string and add the width parameter.


PS > Get-CsAnalogDevice | ft Identity,RegistrarPool

Identity                                                          RegistrarPool
--------                                                          -------------
CN=Public Telephone,OU=RTC Special Accounts,DC=contoso,D... lync2010.contoso.local
CN=Linksys ATA,OU=RTC Special Accounts,DC=contoso,DC=local  lync2010.contoso.local
CN=HOTLINE,OU=RTC Special Accounts,DC=contoso,DC=local      lync2010.contoso.local
CN=Paging Speaker,OU=RTC Special Accounts,DC=contoso,DC=... lync2010.contoso.local


PS > Get-CsAnalogDevice | ft Identity,RegistrarPool | out-string -Width 160

Identity                                                                         RegistrarPool
--------                                                                         -------------
CN=Public Telephone,OU=RTC Special Accounts,DC=contoso,DC=local            lync2010.contoso.local
CN=Linksys ATA,OU=RTC Special Accounts,DC=contoso,DC=local                 lync2010.contoso.local
CN=HOTLINE,OU=RTC Special Accounts,DC=contoso,DC=local                     lync2010.contoso.local
CN=Paging Speaker,OU=RTC Special Accounts,DC=contoso,DC=local              lync2010.contoso.local

Collections / Arrays

… but what if that doesn’t fix it?

It might be that the object you’re looking at is an array (a “collection”), and PowerShell is only showing the first few entries in that array, rather than the lot.

Here, the fix is to change the $FormatEnumerationLimit value. If you type it on its own into PowerShell the current value – probably 3 – will be returned. If you set a new value of -1, it’ll output ALL entries in your collection.

PS > $FormatEnumerationLimit
PS > $FormatEnumerationLimit=-1


PS > Get-CsCertificate

Issuer           : CN=contoso-CA, DC=contoso, DC=local
NotAfter         : 6/07/2013 5:09:37 PM
NotBefore        : 17/02/2012 7:04:52 PM
SerialNumber     : 1234567890ABCDEF
Subject          : CN=lync2010.contoso.local, OU=IT, O=contoso, L=Sydney, S=NSW, C=AU
AlternativeNames : {,, lync2010.contoso.local...}
Thumbprint       : 1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF
Use              : Default


PS > Get-CsCertificate

Issuer           : CN=contoso-CA, DC=contoso, DC=local
NotAfter         : 6/07/2013 5:09:37 PM
NotBefore        : 17/02/2012 7:04:52 PM
SerialNumber     : 1234567890ABCDEF
Subject          : CN=lync2010.contoso.local, OU=IT, O=contoso, L=Sydney, S=NSW, C=AU
AlternativeNames : {,, lync2010.contoso.local,,, meet,,,}
Thumbprint       : 1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF
Use              : Default


Credit: This post is largely a re-write of this AWESOME Poshoholic gem.

Here’s a TechNet post with a few more formatting tips.



  1. This is the correct answer!
    Also, PS’ Format-Table will truncate a columned response after that entry’s first 4 items. So if you were looking up a prefix list of addresses you’d only see the first four of them, with the feared ellipses following.

    But this breaks that problem as well. Good work

  2. Sill problems with “$FormatEnumerationLimit=-1”. I fixed width size not that usable in my case
    $logName = ‘Microsoft-Windows-DNS-Client/Operational’

    $log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName
    Get-WinEvent -LogName Microsoft-Windows-DNS-Client/Operational | where { $_.ID -gt 1010 }

    • $FormatEnumerationLimit = -1
      Get-WinEvent -LogName ‘System’ -FilterXPath ‘

      (EventID >= 4608 and EventID <= 4609)
      or EventID=4624
      or EventID=4634
      or EventID=4647
      or (EventID >= 4778 and EventID <= 4779)
      or (EventID >= 4800 and EventID <= 4803)
      [@Name=”SubjectUserName” or @Name=”TargetUserName”] and (Data=”username”)


      ‘ | Out-String -Width 500

    • Hi Mark,

      Great question, but I don’t think you’re going to like the answer. I think you’re going to hit the same brick wall I did when I was trying to manually control column widths in

      Check out the two images in this tweet: the first is the problem I was trying to solve, and in the code extract in the next image is the bit you THINK is your salvation, the “width=” code.

      that code snipped will work beautifully on your Windows 7 and 8 test machines, your servers … and then you’ll test it on Windows 10 and it will all turn to kaka – the first image.

      The apparent cause is a deliberate change the P$ team made:
      “When you use the Format-Table command, table columns are now automatically formatted by evaluating the first 300ms of data that passes through the stream.” – and that seems to mean it’s *ignoring* your hard-coded widths.

      Things might have changed since then, as I’ve not revisited it.

      i wish you the best of luck!!

      – G.

      • One more for you: if you’re REALLY keen, P$ MVP Kirk Munro suggested this:

        “Out of curiousity, have you tried defining the layout in a format.ps1xml file to see how well that works?

        Have a look at Get-Service — that command returns strictly formatted data. Strictly formatted data using format.ps1xml files does not get undone by the 300ms “smart formatter”.”

        I didn’t go there as it seemed like an ENORMOUS amount of effort to go to for my little script.

        – G.

  3. How to get full InstanceId in this case?
    1) $FormatEnumerationLimit set to -1
    2) sending output to txt file doesn’t help
    3) adding |out-string -Width 160 changes only first column, not the instnaceIds

    PS C:\WINDOWS\system32> Get-PnpDevice -FriendlyName “*brother*”

    Status Class FriendlyName InstanceId
    —— —– ———— ———-
    OK PrintQueue Brother DCP-J105 Printer SWD\PRINTENU…
    OK SoftwareDevice Brother DCP-J105 [945330b5c59e] SWD\DAFWSDPR…
    OK PrintQueue Brother DCP-J105 Printer (Copy 1) SWD\PRINTENU…
    OK Image Brother DCP-J105 [945330b5c59e] SWD\DAFWSDPR…
    OK Printer Brother DCP-J105 Printer SWD\PRINTENU…
    OK Image Brother DCP-J105 LAN ROOT\IMAGE\0000
    OK Image Brother DCP-J105 LAN ROOT\IMAGE\0001
    OK WSDPrintDevice Brother DCP-J105 [945330b5c59e] SWD\DAFWSDPR…

  4. Thanks, this really helped me get the full length of an array on Exchange output, but I’ll note, it’s simply crazy the hoops I had to jump though just to get powershell to enumerate the entire list into a readable string. Makes me appreciate nix shell (i.e. Bash) even more. As always, MS complicates things more than necessary

  5. Hi Greig,

    how to get the entire synopsis in a search ? I’m afraid it’s an array and we get only the 1st record.

    get-help about_* | where {$_.synopsis -match “block”}|ft -wrap

    with this we don’t get about_testdrive for example

    • Hi Thierry.

      I’ve had several goes at this and drawn a blank each time. I suspect it has something to do with the object type, which is “HelpInfoShort”.

      Interestingly, if you capture “get-help about_BeforeEach_AfterEach”, the synopsis that comes out is a ‘mid-string’ extract, where you’d expect it to start from the start and then be truncated.

      PS C:\> $about = get-help about_BeforeEach_AfterEach
      PS C:\> $about.Synopsis
      performed at the beginning and end of every It block. This can eliminate duplication of code

      I’ve asked around the MVPs to see if anyone can shed any light on the issue.

      – Greig.

      • The issue here is a combination of a bug in Get-Help and a limitation in about_* help files.

        All about_* help files are just text files. They have a recommended structure that they should follow, but ultimately they are just text. Not HTML. Not Markdown. Just text. Since they are just text, which may or may not follow the recommended structure, it is difficult to harvest “properties” from them. That is the limitation that you’re facing right now.

        The bug is very clearly highlighted by the fact that `Get-Help -Category HelpFile | where Synopsis -match ‘block’ | Format-Table -Wrap` (note, the first segment of that pipeline is a better way to get help files than Get-Help about_*) does not return the full synopsis. Instead it only shows the first line of the synopsis for each of the loosely structured files in question. I would argue that is a bug, and that Get-Help -Category HelpFile is being lazy when it comes to trying to parse this loosely structured information. It could do better, by trying harder to pull out the full synopsis and parsing help files based on each of the recommended sections. It won’t be perfect, but it could be much better. If I recall correctly I did work related to this long ago when I worked on the PowerGUI team, harvesting the full information available in help files by the main “properties” that are defined by the headers. That’s work from 9+ years ago now though.

    • Hi Bartosz,

      I think your problem here is simply that there’s simply too much information to show on the screen when output with format-table (“ft”). Select fewer properties – or format-list (“fl”) and it’s fine.

      Does this give you enough information?

      Get-NetFirewallAddressFilter | select -property Local*,Remote* | ft

      – Greig.

Leave a Reply

Your email address will not be published. Required fields are marked *

... and please just confirm for me that you're not a bot first: Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.