Managing Mail Messages
Now that you know how to retrieve information about and manage queues and links, you can manage mail messages. Before you can manage a mail message, you have to locate it. You can again use GetCollectionOfInstances.wsf, but this time you need to specify the Exchange_QueuedSMTPMessage class in the WQL query. However, WMI doesn't let you query all instances of the Exchange_QueuedSMTPMessage class that you might have across the various queues. You must specify the queue and link that contains the message. The WMI properties you need to include are the Exchange_SMTPQueue class's LinkID, LinkName, ProtocolName, QueueID, and QueueName properties. Fortunately, getting these properties' values is easy. You can simply run GetCollectionOfInstances.wsf against a WQL query that specifies the Exchange_SMTPQueue class, as I did to obtain the SMTP queue information in Web Figure 1. Figure 4 shows a sample WQL query that retrieves a mail message. Web Figure 4 contains the output from this query. . . .