Export (0) Print
Expand All

Get-Message

 

Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1

Topic Last Modified: 2007-08-29

Use the Get-Message cmdlet to view the details of one or more messages in a queue on a computer that has the Hub Transport server role or the Edge Transport server role installed.


Get-Message [-BookmarkIndex <Int32>] [-BookmarkObject <MessageInfo>] [-Filter <String>] [-IncludeBookmark <$true | $false>] [-IncludeRecipientInfo <SwitchParameter>] [-ResultSize <Unlimited>] [-ReturnPageInfo <$true | $false>] [-SearchForward <$true | $false>] [-Server <ServerIdParameter>] [-SortOrder <SortOrderEntry[]>]


Get-Message [-Identity <MessageIdentity>] [-BookmarkIndex <Int32>] [-BookmarkObject <MessageInfo>] [-IncludeBookmark <$true | $false>] [-IncludeRecipientInfo <SwitchParameter>] [-ResultSize <Unlimited>] [-ReturnPageInfo <$true | $false>] [-SearchForward <$true | $false>] [-SortOrder <SortOrderEntry[]>]


Get-Message [-BookmarkIndex <Int32>] [-BookmarkObject <MessageInfo>] [-IncludeBookmark <$true | $false>] [-IncludeRecipientInfo <SwitchParameter>] [-Queue <QueueIdentity>] [-ResultSize <Unlimited>] [-ReturnPageInfo <$true | $false>] [-SearchForward <$true | $false>] [-SortOrder <SortOrderEntry[]>]

The Get-Message cmdlet displays the details of one or more messages that are in an existing queue on the Hub Transport server or the Edge Transport server. If you provide no parameters, the command queries all messages in any queue on the local server and returns a single page of results. The default page size is 1,000 objects. You can display messages on a remote server by including the server name as part of the Identity parameter or the Queue parameter or by including the Server parameter with a filter query. The Identity parameter, Queue parameter, and Filter parameter sets are mutually exclusive.

To run the Get-Message cmdlet, the account you use must be delegated the Exchange Server Administrators role.

To run the Get-Message cmdlet on a computer that has the Edge Transport server role installed, you must log on by using an account that is a member of the local Administrators group on that computer.

For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.

 

Parameter Required Type Description

BookmarkIndex

Optional

System.Int32

Use the BookmarkIndex parameter to specify the position in the result set where the displayed results start. The value of this parameter is a 1-based index in the total result set. BookmarkIndex cannot be used with the BookmarkObject parameter.

BookmarkObject

Optional

Microsoft.Exchange.Data.QueueViewer.MessageInfo

Use the BookmarkObject parameter to specify the object in the result set where the displayed results start. BookmarkObject cannot be used with the BookmarkIndex parameter.

Filter

Optional

System.String

The Filter parameter requires an expression that specifies the property value criteria for the messages that you want to display. The expression includes a property name that is followed by a comparison operator and value. The following message properties are valid criteria for the Filter parameter:

  • DateReceived   The date that the message was received.

  • ExpirationTime   The time that a message will expire.

  • FromAddress   The Simple Mail Transfer Protocol (SMTP) address of the sender of a message. This value is taken from MAIL FROM: in the message envelope.

  • Identity   An integer that represents a particular message and an optional server and queue identity.

  • InternetMessageId   The value of the Message-ID: header field. This property is expressed as a GUID followed by the SMTP address of the sending server, as in this example: 67D7543D6103DC4FBEBA6BC7205DACABA61231@exchange.contoso.com.

  • LastError   A text string of the last error recorded for a message.

  • MessageSourceName   A text string of the name of the component that submitted this message to the queue.

  • Queue   Specifies the identity of the queue that holds the message. Enter the queue identity in the form of Server\destination, where destination is a remote domain, mailbox server, or persistent queue name.

  • RetryCount   The number of times that delivery of a message to a destination was tried.

  • SCL   The SCL property specifies the spam confidence level of the message. Valid SCL entries are integers 0 through 9. An empty SCL property value indicates that the message hasn't been processed by the Content Filter agent.

  • Size   The size of a message.

  • SourceIP   The IP address of the external server that submitted the message to the Exchange organization.

  • Status   The current message status. Message status options are Active, Retry, Suspended, PendingSuspend, or PendingRemove.

  • Subject   A text string that represents the e-mail subject. The value is taken from the Subject: header field.

You can specify multiple filter criteria by using the - and comparison operator. Property values that are not expressed as a single integer must be enclosed in quotation marks.

Identity

Optional

Microsoft.Exchange.Data.QueueViewer.MessageIdentity

Use the Identity parameter to specify the MessageIdentity integer. This is an integer that represents a particular message and an optional server and queue identity. The syntax for this parameter can be specified as follows:

  • Server\QueueIdentity\MessageIdentity

  • QueueIdentity\MessageIdentity

  • Server\*\MessageIdentity

  • MessageIdentity

IncludeBookmark

Optional

System.Boolean

Use the IncludeBookmark parameter to specify whether to include the bookmark object when the query results are displayed. The IncludeBookmark parameter is valid when it is used with the BookmarkObject or BookmarkIndex parameters. If you do not specify a value for the IncludeBookmark parameter, the default value of $true is used.

IncludeRecipientInfo

Optional

System.Management.Automation.SwitchParameter

Use the IncludeRecipientInfo parameter to display the message recipients in the Recipients field. If you do not include the IncludeRecipientInfo parameter, the Recipients field is blank.

Storing the results of a Get-Message -IncludeRecipientInfo command in a variable allows you to display additional properties for the message recipients. The following list describes the available recipient properties:

  • Address   The e-mail address of the recipient

  • Type   The recipient type may be External, Mailbox, or DL. DL is used when the destination is an expansion server.

  • FinalDestination   The distinguished name (DN) of the object that is used to route the message. The object could be a connector, a mailbox server or an expansion server.

  • Status   The recipient status may be Complete, Ready, or Retry.

  • LastError   The SMTP response after the last delivery attempt or a localized error message if the message is placed in the unreachable queue.

For example, to store the recipient information of a message in the "Contoso.com" remote delivery queue that has the MessageIdentity value of 1234 to a variable named $x, use the following command:

$x=Get-Message -Identity "Contoso.com\1234" -IncludeRecipientInfo

To display the extended recipient properties that are now stored in the $x variable, use the following command:

$x.Recipients

Queue

Optional

Microsoft.Exchange.Data.QueueViewer.QueueIdentity

Use the Queue parameter to specify the identity of the queue that contains the messages that you want to display. Enter the queue identity in the form of Server\destination, where destination is a remote domain, mailbox server, or persistent queue name.

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

Use the ResultSize parameter to specify the total number of items to display in the result set. The default ResultSize parameter value is set to 1,000. ResultSize supports an unlimited number of results, but Microsoft Exchange limits the result set to 250,000.

ReturnPageInfo

Optional

System.Boolean

The ReturnPageInfo parameter is a hidden parameter. Use it to return information about the total number of results and the index of the first object of the current page. The default value is $false.

SearchForward

Optional

System.Boolean

Use the SearchForward parameter to specify whether to search forward or backward in the result set. The default value is $true. This value causes the result page to be calculated forward from either the start of the result set or forward from a bookmark if specified.

Server

Optional

Microsoft.Exchange.Configuration.Tasks.ServerIdParameter

Use the Server parameter to specify the name of the server to connect to by using remote procedure call (RPC) that contains the queues that hold the messages that you want to display. Enter the Server parameter as a host name or a fully qualified domain name (FQDN). If this parameter is not used, the local server is queried.

SortOrder

Optional

Microsoft.Exchange.Configuration.Tasks.SortOrderEntry[]

Use the SortOrder parameter to specify an array of message properties that are used to control the sort order of the result set. Separate each property by using a comma. Append a + symbol to the beginning of the property name to display the results in ascending order. Append a - symbol to the beginning of the property name to display the results in descending order. If you do not specify a sort order, the result set is displayed in ascending order by MessageIdentity integer.

The following examples show how to query for messages by using the Get-Message command. The first example shows how to display all messages that are queued on the local server and were received from any sender at the specified domain. The command is piped to the Format-List command to format the results as a detailed list.

The second example shows how to display all messages that are queued on the local server, were received from any sender at the specified domain, and have an SCL value that is more than 3.

The third example shows how to connect to a remote server and then how to display all messages that are queued on the remote server in the specified sort order. The results are sorted first in ascending order by sender address and then in descending order of size.

For more information about pipelining, see Pipelining.

For more information about how to work with the output of a command, see Working with Command Output.

For more information about how to use the Exchange Management Shell to perform queue viewer tasks, see Using the Exchange Management Shell to Manage Queues.

Get-Message -Filter {FromAddress -like "*@contoso.com"} | format-list
Get-Message -Filter {FromAddress -like "*@contoso.com" -and SCL -gt 3}
Get-Message -Server exchange.contoso.com -SortOrder: +FromAddress,-Size
 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft