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:

[PS] C:\>Get-ReceiveConnector "Relay Connector" | fl remoteipranges


RemoteIPRanges : {10.0.0.14, 10.0.0.20, 10.0.0.19, 10.0.0.18, 10.0.0.17, 10.0.0
                 .16, 10.0.0.15, 10.0.0.10, 10.0.0.9, 10.0.0.8, 10.0.0.7, 10.0.
                 0.6, 10.0.0.5, 10.0.0.4, 10.0.0.13, 10.0.0.12...}

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 ..\bin\Exchange.ps1 file. This variable has a default value of 16.

[PS] C:\>$FormatEnumerationLimit
16

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

[PS] C:\>$FormatEnumerationLimit =-1

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

[PS] C:\>Get-ReceiveConnector "Relay Connector" | fl remoteipranges


RemoteIPRanges : {10.0.0.14, 10.0.0.20, 10.0.0.19, 10.0.0.18, 10.0.0.17, 10.0.0
                 .16, 10.0.0.15, 10.0.0.10, 10.0.0.9, 10.0.0.8, 10.0.0.7, 10.0.
                 0.6, 10.0.0.5, 10.0.0.4, 10.0.0.13, 10.0.0.12, 10.0.0.11, 10.0
                 .0.3, 10.0.0.2, 10.0.0.1}
About Paul Cunningham

Paul is a Microsoft Exchange Server MVP and publisher of Exchange Server Pro. He also holds several Microsoft certifications including for Exchange Server 2007, 2010 and 2013. Connect with Paul on Twitter and Google+.

Comments

  1. 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. It works… thanks man… it solved lots of manual work….

    Vishnu

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

Leave a Comment

*

We are an Authorized DigiCert™ SSL Partner.
Loading...

Still running Exchange 2003? Time to get moving and start your upgrade. Find out how - Click Here