The Remove-Message cmdlet deletes one or more messages that are in a queue on a Hub Transport server or an Edge Transport server. A message that is being transmitted to multiple recipients might be located in multiple queues. If you specify an Identity parameter, the message will be removed from a single queue if that identity matches only a single message. If the identity matches more than one message, you will receive an error. To remove a message from more than one queue in a single operation, you must use a filter. If you try to remove a message that is currently being delivered, the message status will change to PendingDelete. Message delivery will not be interrupted, but if the delivery fails and causes the message to re-enter the queue, it will then be removed.
You must use an Identity parameter or a Filter parameter. These two parameter sets are mutually exclusive.
To run the Remove-Message cmdlet, the account you use must be delegated the Exchange Server Administrator role and local Administrators group for the target server.
To run the Remove-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.