7.14. Deleting Messages from a Queue
Problem
You need to delete messages from a queue on your Exchange virtual server.
Solution
Using a graphical user interface
Open the Exchange System Manager (Exchange System Manager.msc).
Expand the organization→ Administrative Groups→ target administrative group→ Servers.
Expand the appropriate server container and select the Queues object.
The right pane will display all queues on this server, including MTA, SMTP, and foreign connector queues.
Click the Source field of the header to group the queues according to the component that they are associated with and find the appropriate SMTP virtual server.
Click on a queue to select it and click Find Messages, or double-click the queue to open the search window. By default, the search will return 100 messages at a time.
If you wish to restrict the search, modify the search parameters.
Click Find Now.
Select the message to delete by clicking on it; you can use Shift and Ctrl with additional clicks to select multiple messages. Right-click your selection, select one of the two Delete options, and confirm the deletion.
Using VBScript
' This code deletes a given message within an Exchange SMTP queue. ' ------ SCRIPT CONFIGURATION ------ ' The host name of the Exchange server strHostname = "<ExchangeServerName>
" ' e.g., red-exch02 ' Name of the SMTP queue to search for messages strQueueName = "<SMTPQueueName>
" ' e.g., 3sharp.com ' Message ID of the message to delete strMessageID = "<MessageID>
" ' ------ END CONFIGURATION ...
Get Exchange Server Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.