Bulk move of messages between Queues

I came to work this morning and found over 500000 dead messages due to the technical hitch.
The scribe console only allows you to move a 100 messages at a time. I did not fancy the option of moving it manually!!.
So I quickly knocked up this PowerShell script to do the job. Worked a treat.
Here is the script:

# Load the messaging DDL[Reflection.Assembly]::LoadWithPartialName(" System.Messaging" )
#Set Up Queues
$qFrom = new-object System.Messaging.MessageQueue " .\private$\ScribeDeadMessage"

$qTo = new-object System.Messaging.MessageQueue " .\private$\ScribeIn"

$i = 1 # counter
do {
$qTo.send( $qFrom.Receive())
$i++
}

while ($i -le 500000)

Any other methods out there?

Posted by chris j. on Oct 6 2009 2:55PM { U702 , F8 , T891 , C2488 }

(2) Answers

Login