Powershell script to purge all private MSMQ queues

Posted by Mikael Östberg | Filed under ,

Sometimes when working heavily with MSMQ, you need to purge your queues and the MMC snap in does not do the job good.

Here is a powershell script that does it better:

 

[Reflection.Assembly]::LoadWithPartialName("System.Messaging")

[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("MachineName") 
| % { $_.Purge(); }

Save is into a file named purgeAll.ps1 and run in Powershell by simply writing purgeAll.ps1

 

Comments

Add comment




biuquote
  • Comment
  • Preview
Loading