Tip: Format Output Data to Expose More of the Information You Want

Follow Our Daily Tips

RSS | Twitter | Blog | Facebook

Tell Us Your Tips

Share your tips and tweaks.

When you work with the Exchange Management Shell, the standard output won’t necessarily provide all the information you are looking for. Often, you need to format the output as a list or table using Format-List or Format-Table, respectively, to get the additional information you desire.

Format-List comes in handy when you are working with a small set of resources or want to view all the properties that are available. Once you know what properties are available for a particular resource, you can format the output as a table to view specific properties.

For example, if you format the output of Get-MailboxStatistics as a list, you see all the properties that are available for mailboxes, as shown in this example and sample output:
get-mailboxstatistics -identity "cpandl\daniele" | format-list

Output

 

AssociatedItemCount : 2655 
DeletedItemCount : 121 
DisconnectDate : 
DisplayName : Daniel Escapa 
ItemCount : 2451 
LastLoggedOnUserAccount : NT AUTHORITY\SYSTEM 
LastLogoffTime : 6/15/2010 12:58:18 PM 
LastLogonTime : 6/15/2010 12:58:14 PM 
LegacyDN : /O=FIRST ORGANIZATION/OU=EXCHANGE ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=DANIEL ESCAPA 
MailboxGuid : d3f6ce55-fe3d-4beb-ae65-9c9f7edaf995c
ObjectClass : Mailbox 
StorageLimitStatus : BelowLimit 
TotalDeletedItemSize : 97 KB (97,235 bytes) 
TotalItemSize : 1155.11 KB (1,155,445 bytes) 
Database : Customer Service Primary 
ServerName : CORPSERVER45 
DatabaseName : Customer Service Primary 
MoveHistory : 
IsQuarantined : False 
IsArchiveMailbox : False 
Identity : d3f6ce44-fe0c-4beb-ae79-9c9f8eaf123c 
MapiIdentity : d3f6ce44-fe0c-4beb-ae79-9c9f8eaf123c 
OriginatingServer : corpserver45.cpandl.com 
IsValid : True

Once you know the available properties, you can format the output as a table to get exactly the information you want to see. In this example, you get information about all the mailboxes in the Engineering Primary database and format the output as a table:
Get-MailboxStatistics -Database 'Engineering Primary' | format-table DisplayName, TotalItemSize, TotalDeletedItemSize, Database, ServerName

From the Microsoft Press book Microsoft Exchange Server 2010 Administrator’s Pocket Consultant by William R. Stanek.

Looking for More Tips?

For more tips on Exchange Server and other Microsoft technologies, visit the TechNet Magazine Tips library.