Question

I need to create a PRIVATE message queue on a remote machine and I have resolved to fact that I can't do this with the .NET Framework in a straight forward manner. I can create a public message queue on a remote machine, but not a PRIVATE one. I can create a message queue (public or private) locally.

I am wondering if anyone knows how to access MSMQ through WMI.

Edit: I don't see anything to do it with using the MSMQ Provider. May have to get tricky and use PSExec to log onto a remote server and execute some code.

Was it helpful?

Solution

Yes, queue creation is simple in .NET, however you cannot create a private queue on a remote machine this way. I have been thinking about adding queue creation to the MSMQ WMI provider for some time... If you need it for a real product / customer, you can contact me and I will consider giving this feature a priority. All the best, Yoel Arnon

OTHER TIPS

A blog post about MSMQ and WMI is here: http://msmq.spaces.live.com/blog/cns!393534E869CE55B7!210.entry

It says there is a provider here: http://www.msmq.biz/Blog/MSMQWmiSetup.msi

It also says there is a reference here: http://www.msmq.biz/Blog/MSMQ%20WMI%20Provider%20Objects.doc

Hope this helps.

WMI can't do this out-of-box. The previous answer has some obsucre WMI provider, but it doesn't even seem to support Queue creation.

This is very simple in .NET however! I wouldn't go so far as PSExec. MessageQueue.Create

I was wanting to create remote private queues also, but since .NET doesn't support it, we decided we will just use remote public queues instead. If we set Send and Receive permissions on the queues as desired, this should be fine.

One idea for a work around would be to write your own Windows service or web service that runs on the same machine where the queue needs to reside. You could call this service remotely through a socket or over http, and your locally-running code could create the local private queue.

If you use the direct name format to reference the queue, you can Send and Receive from a remote private queue.

set qinfo = CreateObject("MSMQ.MSMQQueueInfo")
qinfo.PathName = ".\Private$\TestQueue"
qinfo.Label = ".\Private$\TestQueue"
qinfo.Journal = "1"
qinfo.Create

Copy the code in a text editor, save the file as .vbs and execute.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top