Bruno
Bruno

Reputation: 4665

Purge a public MSMQ queue in Powershell 2.0

I found this post Purge MSMQ queue and reset IIS from a bat file

to purge a private MSMQ queue. I thought I could adapt it to purge a public queue by changing Private by Public but it failed.

How can I purge a public MSMQ queue in Powershell 2.0?

Thanks!

Upvotes: 3

Views: 1553

Answers (1)

Bruno
Bruno

Reputation: 4665

Got it, I had to remove private$ instead of changing it.

So this does the job :

[Reflection.Assembly]::LoadWithPartialName("System.Messaging")
$queueName = '.\testQueue'
$queue = new-object -TypeName System.Messaging.MessageQueue -ArgumentList $queueName
$queue.Purge()

Upvotes: 2

Related Questions