Home ยป Exchange Server ยป How to Prevent Truncation of Long Output in Exchange Management Shell

How to Prevent Truncation of Long Output in Exchange Management Shell

When working in the Exchange Management Shell you may encounter some query output that gets truncated with ellipsis.ย  An example of this is a long RemoteIPRanges list on a Receive Connector.ย  For example:

The reason this happens is that the default Powershell environment for Exchange has an enumeration limit. This is controlled by the $FormatEnumerationLimit variable in the ..binExchange.ps1 file. This variable has a default value of 16.

You can modify the variable to a larger value, or set it to -1 for “unlimited”.

Now when we run the same command the output is no longer truncated.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server

25 comments

  1. Mike Koch says:

    Exchange.ps1 contains a signature block. Doesn’t modifying the $FormatEnumerationLimit variable break the signature, and will that affect the shell’s ability to load that PS1 file?

    • Hi Mike, actually I don’t edit the Exchange.ps1 file, I just change the variable at the cmd line for that current session.

      It might make sense to configure a higher limit in your Powershell profile but I’ve read it can cause problems with some other output scenarios, so I just bump it up as required per-session.

  2. Bids says:

    I was struggling for the last 1 hour to prevent the truncation, checked so many sites, but only your solution($FormatEnumerationList) worked. ๐Ÿ™‚

  3. Hank says:

    Tried this on a Windows 2003 server 64bit with Exchange 2007 sp2 from the EMS and while I can change the variable, the output is the same. There are hundreds of IPs and I only get 7.
    Would it be that you need to be on Windows 2008 and up?

  4. Brian G. Shacklett says:

    Yes! This has been one of the most frustrating things about Powershell for me. That line is now in my Microsoft.PowerShell_profile.ps1.

    Thanks!

  5. Nate says:

    So I’m reading one of your articles which is showing me how to deal with one thing that comes up in the Exchange Management Shell, then run into this problem, google it, and what do you know, it’s another article from you explaining how to deal with that.

    Good work, and thanks!

  6. @gregseeber says:

    thanks paul. I was actually fighting a Lync commandlet and found your tip .. now I can see it ALL. ๐Ÿ™‚

  7. Bob says:

    You can also run it like this:

    Get-ReceiveConnector “Relay Connector” | select -ExpandProperty remoteipranges | select expression

    You may want to pipe it to a txt file or a csv file if you have several IP’s listed.

  8. mark says:

    I have this problem:
    If I use this in EMS, it shows all folders and FolderPath is not truncated
    Get-MailboxFolderStatistics $Arg1 | FT Name,ItemsinFolder,FolderPath -Autosize >> c:list.txt

    If I save the command in a ps1 file and run it, the FolderPath is truncated.
    What goes wrong?

  9. KERR says:

    I googled “powershell truncated output” and had to laugh when the first google result is yours, showing a screenshot of the exact command that I’m trying to run.

    Thanks!

Leave a Reply

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