Skip to content

Instantly share code, notes, and snippets.

@gbiellem
Last active November 4, 2015 00:39
Show Gist options
  • Save gbiellem/4c397d4e44a9e248c346 to your computer and use it in GitHub Desktop.
Save gbiellem/4c397d4e44a9e248c346 to your computer and use it in GitHub Desktop.
Delete all Private MSMQ Queues - even those with long queue names
# 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