Created
October 7, 2015 14:01
-
-
Save ramonsmits/691c998c21e39a469471 to your computer and use it in GitHub Desktop.
Purge all MSMQ private queues and corresponding journal queues
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
[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