How to Prevent Truncation of Long Output in Exchange Management Shell

by Paul Cunningham on December 17, 2009

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}

Did you find this post useful? If so please leave a comment below. You may also subscribe to the RSS feed to receive new posts automatically.

{ 1 trackback }

How to Add Remote IP Addresses to Existing Receive Connectors | Exchange Server Pro
January 5, 2010 at 11:48 am

{ 2 comments… read them below or add one }

Mike Koch December 18, 2009 at 6:19 am

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?

Paul Cunningham December 18, 2009 at 9:10 am

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.

Leave a Comment