Category Archives: MSMQ

Write MSMQ Messages from PowerShell

This PowerShell script sends a message to an MSMQ. I did it this particular way because NServiceBus can consume messages sent like this. [Reflection.Assembly]::LoadWithPartialName("System.Messaging"); $queueName = '.\Private$\your.queue.name'; $queue = new-object System.Messaging.MessageQueue $queueName; $utf8 = new-object System.Text.UTF8Encoding; $tran = new-object System.Messaging.MessageQueueTransaction; … Continue reading

Posted in CodeMinder, MSMQ, PowerShell, Programming | 5 Comments

Read MSMQ Messages from PowerShell

This script dumps the contents of an MSMQ to the console. This one dumps the Journal contents of a private queue; of course you’ll have to adjust that line for your queue. [Reflection.Assembly]::LoadWithPartialName(<span class="str">"System.Messaging"</span>) $queueName = <span class="str">'.\Private$\your.queue.name\Journal$'</span>; $queue = … Continue reading

Posted in CodeMinder, MSMQ, PowerShell, Programming | Leave a comment