Last active
November 4, 2015 00:39
-
-
Save gbiellem/4c397d4e44a9e248c346 to your computer and use it in GitHub Desktop.
Delete all Private MSMQ Queues - even those with long queue names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USE COM instead of .Net MessageQueue delete as it handles longer queue names | |
[Reflection.Assembly]::LoadWithPartialName("System.Messaging") | |
$q = new-object -ComObject MSMQ.MSMQQueueInfo | |
$queues = [System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("localhost") | |
$queues | % { | |
$q.FormatName = $_.FormatName | |
$q.Delete() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment