Expand powershell output to display all items

To display comprehensive and complete information in powershell it is sometimes necessary to expand powershell output. By default the displayed output for attributes with long or many values is cut off and an ellipsis (…) indicates not shown items.

To expand powershell output of a simple CMDlet where you just want to display all values of one attribute the -ExpandProperty switch will do the job :

Get-Mailbox -Identity “MailboxName” | select -ExpandProperty EmailAddresses | fl

Based on this example where we query the EmailAddresses attribute the underlying properties will be listed with their values completely.

If you query more than one attribute you cannot use the -ExpandProperty switch on more than one selection. Nonetheless you can expand powershell output by modifying the value for enumerated items included in the display. This can be achieved by changing the value of $FormatEnumerationLimit : ( The default value is 4 )

$FormatEnumerationLimit = -1

This will expand powershell output for all queried attributes and sets the $FormatEnumerationLimit to unlimited. The modified value is valid within the current powershell session. To test it you can open another PS window and query the value in the new session :


The output should show the same value you had set before modifying the value of $FormatEnumerationLimit to -1 . ( most likely 4 )

Find an example below to query more attributes with a simple select :

$FormatEnumerationLimit = -1

Get-Mailbox -Identity “MailboxName” | select PrimarySmtpAddress, Emailaddresses, AddressListMembership | fl

$FormatEnumerationLimit = 4

In the example above I have set the FormatEnumerationLimit to unlimited , triggered the CMDlet to list the selected attributes and have set back the FormatEnumerationLimit to default ( just to go for sure ).

This proves extremely useful within a loop where you want to generate a comprehensive .csv output for a customer or colleague with all items included.


List mailbox expanded mailbox attributes :
Script to list mailbox attributes


Leave a Reply

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