I needed to clear a bunch of messages out of the mail queue this morning, and thought it would be super nice to be able to query the queue(s) using Powershell. Any scripts out there?
Note: this is for SBS 2003, so no Exchange 2007 - but as an upgrade is near, a 2007-only answer will be just fine...
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?
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