Is there any way in MSMQ to delete all private queues?
I have thousands of private queues on my computer, I'm fairly sure most, if not all, of them, are caused by a badly behaved app that creates a new queue with a random GUID for its name every time it starts up.
Now I want to create a couple of other private queues to do some work with MSMQ, I'm finding that the thousands of unused existing queues are not only cluttering up the view when I open Private Queues in the Computer Management tool, but I suspect they are the reason why opening Private Queues in Computer Management takes ages on my machine.
I can delete individual queues by just selecting one and hitting delete, but there doesn't seem to be an obvious way of selecting a range of queues to delete together.
Answer
I'm not sure of the version of Windows you're using but I'm assuming you have MSMQ 3.0 installed. That being the case, you can query all your private MSMQ objects using VBS and calling the Private Queues property in the MSMQ Application Object and storing them as a Variant.
Then, I would cycle through your Variant and use the Delete property of MSMQQueueInfo and delete each queue.
Hope that helps.
Comments
Post a Comment