What to do? Powershell, of course! :) Here goes the script:
[Reflection.Assembly]::LoadWithPartialName("System.Messaging")
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("someserver") | % {".\" + $_.QueueName} | % {[System.Messaging.MessageQueue]::Delete($_); }
You may also filter them by name if you do not need to remove them all as I need:
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("someserver") | % {".\" + $_.QueueName} | ? {$_ -match "SOME_REGEX_FILTER"} | % {[System.Messaging.MessageQueue]::Delete($_); }
And SOME_REGEX_FILTER is... Yeap, some regex filter :) The -match operator allow us using regular expressions in the Where-Object (alias "?") clause.
Have fun with PowerShell!
5 comments:
How do you run this?
How can I purgue queues in remote server?
Thanks for sharing such a wonderful article, I hope you could inspire more people. Visit my site too.
n8fan.net
www.n8fan.net
I really enjoyed reading your article. I found this as an informative and interesting post, so i think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article.
edupdf.org
I discovered your blog site on google and test a number of of your early posts. Proceed to maintain up the excellent operate. I simply extra up your RSS feed to my MSN News Reader. In search of ahead to studying extra from you afterward!… best online casinos
Post a Comment