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!
3 comments:
How do you run this?
How can I purgue queues in remote server?
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