September 3, 2010

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}

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.

Leave a Comment

*