Monthly Archives: November 2011

NDesk.Options

Parsing command-line arguments can be deceptively tricky. Often it starts as something very simple to do manually, but as more arguments and formats and flexibility are desired, the effort required to do it well can explode. So there are several … Continue reading

Posted in Programming | Leave a comment

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