I have list of over 20 queues that needs to be added as private queue in MSMQ.
Is there a way to do it using
Command Line
C# programming
If there is a way to do using some sort of script or .net programming then I could add it with out manually inputting it and causing typos.
Please let me know.
thanks
using System.Messaging;
//...
void CreateQueue(string qname) {
if (!MessageQueue.Exists(qname)) MessageQueue.Create(qname);
}
You can only create private queues on your local computer. For more information see: Creating Queues
For command line, you can create a .vbs file with following content:
Option Explicit
Dim objInfo
Dim objQue
Dim objMsg
Dim strFormatName ' Destination
strFormatName = "direct=os:.\private$\test"
Set objInfo = CreateObject("MSMQ.MSMQQueueInfo")
Set objMsg = CreateObject("MSMQ.MSMQMessage")
objMsg.Label = "my message"
objMsg.Body = "This is a sample message."
objInfo.FormatName = strFormatName
set objQue = objInfo.Open( 2, 0 )
' Send Message
objMsg.Send objQue
' Close Destination
objQue.Close
Set objMsg = Nothing
Set objInfo = Nothing
msgbox "Done..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With