Skip to content

Instantly share code, notes, and snippets.

@ramonsmits
Created October 7, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramonsmits/691c998c21e39a469471 to your computer and use it in GitHub Desktop.
Save ramonsmits/691c998c21e39a469471 to your computer and use it in GitHub Desktop.
Purge all MSMQ private queues and corresponding journal queues
[void] [Reflection.Assembly]::LoadWithPartialName("System.Messaging")
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("LOCALHOST") | % { $_.Purge(); }
echo "All MSMQ queues purged"
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("LOCALHOST") | ForEach-Object {
$queueFormatName = "$($_.Path);JOURNAL"
#Write-Host $queueFormatName -foregroundcolor cyan
$queue = New-Object System.Messaging.MessageQueue $queueFormatName
$queue.Purge()
}
echo "All MSMQ journal queues purged"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment