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 ..binExchange.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}
Hi,
another alternative
Get-ReceiveConnector “Relay Connector” | ft id*,remoteipranges -Wrap
BR
12 years later this worked great. Thanks so much.
Hi,
$FormatEnumerationLimit will only work if the output is in Listview but what if its TableView? Here is addition to your kind work https://mcsaguru.com/how-to-fix-truncated-powershell-output/. this guy shows how to fix truncation in ListView and also in TableView. Thanks
Another option is specify a width (width) greater than the default. It can be combined with the autosize or wrap parameter.
Example:
Get-MailboxPermission User | Select-Object User, AccessRights | ft -autosize -wrap | out-string -width 240
In this case, 240 is the number of characters per line.
More info: https://www.sysadmit.com/2019/04/windows-powershell-no-recortar-truncar-salida.html
Where is this file and what is the complete filename?
..binExchange.ps1
There are some missing steps here. Too bad it sounds promising:
[PS] C:\Windows\system32>C:>$FormatEnumerationLimit =-1
& : Ampersand not allowed. The & operator is reserved for future use; use “&” to pass ampersand as a string.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmpersandNotAllowed
[PS] C:\Windows\system32>
The Real Person!
The Real Person!
There was an error in the formatting of the syntax. I’ve fixed the blog post now.
Brilliant that was exactly what I was looking for in use with Get-MailboxJunkEmailConfiguration
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!
dude. thank you for this. was searching everywhere
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?
Pingback: Como evitar saídas truncadas no Exchange Management Shell | How to?
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.
Grrreat man. Nice description and really helped!
Thanks.
Thanks its works fine 🙂
thanks paul. I was actually fighting a Lync commandlet and found your tip .. now I can see it ALL. 🙂
Thanks Paul..really helpful
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!
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!
Thanks Paul! This got me some headaches until I found your post!
Pingback: Prevent Truncation in PowerShell Format-List Command | Adventures of an Oregon K12 IT Director
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?
Pingback: How to Add Remote IP Addresses to Existing Receive Connectors | SAMİ GÖNCÜ
Awesome. Thank you for posting this quick fix. Adding to my PowerShell profile.
I was struggling for the last 1 hour to prevent the truncation, checked so many sites, but only your solution($FormatEnumerationList) worked. 🙂
It works… thanks man… it solved lots of manual work….
Vishnu
Pingback: Prevent Truncation of Long Output in Exchange Management Shell | augi.ath.cx
Pingback: Exchange Proxy Address (alias) Report « Mike Crowley's Whiteboard
Pingback: Exchange Management-Shell – Ausgabe wird abgeschnitten (…) « IT und Ihre Tücken
Pingback: How to Add Remote IP Addresses to Existing Receive Connectors | Exchange Server Pro
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?
The Real Person!
The Real Person!
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.