How to clear Exchange mail queues using PowerShell

Solution 1:

I don't know of a PowerShell script that will do it for Exchange 2003 (there may be one, just can't find it), with Exchange 2007 its very easy.

There is a script here that will clear the entire queue for you, using vbscript. Are you looking to do that, or to remove particular emails?

Solution 2:

Get-ExchangeServer | ?{$_.IsHubTransportServer -eq $true} | Get-Queue | get-message | Remove-Message -withNDR $false

Solution 3:

For Exchange 2003 I would use the Aqadmcli.exe from Microsoft PSS, the following link has a good overview of how to use it to bulk clear queues.

http://community.spiceworks.com/how_to/show/267