Ask a Question

Get list of Private Queues using JavaScript

SOLVED
dbc680
New Contributor

Get list of Private Queues using JavaScript

I just need to get a list of the current private message queues (MSMQ). Not the actual messages, just the name of the queues. Preferably in JavaScript. It doesn't appear to be anywhere in the registry. I also tried looking through the available functions in "dotNET" and "dotNET.System" but don't really see anything about messaging. Is there a way to do this?

3 REPLIES 3
Vallalarasu_P
Frequent Contributor

Hi, Does this helps? https://support.smartbear.com/testcomplete/docs/reference/program-objects/storages/registry.html
With Regards
Vallalarasu Pandiyan
https://www.linkedin.com/in/vallalarasupandiyan/
AlexKaras
Champion Level 3

Hi,

 

https://docs.microsoft.com/en-us/dotnet/api/system.messaging.messagequeue.getprivatequeuesbymachine?...

https://stackoverflow.com/questions/1228684/how-can-i-get-all-the-available-messages-on-a-msmq-queue

https://www.google.com/search?q=MSMQ+get+a+list+of+the+current+private+message+queues

 

Does this help?

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
dbc680
New Contributor

I figured it out! Had to query the WMI object: 

// Query WMI for Message Queues
var privateQueueNames = [];
var Locator = getActiveXObject("WbemScripting.SWbemLocator");
Locator.Security_.ImpersonationLevel = 3;
var wmiobj = Locator.ConnectServer(".", "root\\cimv2");
var queryresults = wmiobj.ExecQuery("Select * from Win32_PerfRawdata_MSMQ_MSMQQueue Where Name like \"%private%\"");
// Push all queue names into privateQueueNames
for( var items = new Enumerator(queryresults); !items.atEnd(); items.moveNext() )
  privateQueueNames.push(items.item().Name);
// Convert the function elements into strings
privateQueueNames = privateQueueNames.join();
privateQueueNames = privateQueueNames.split(",");
Log.Message(privateQueueNames);
cancel
Showing results for 
Search instead for 
Did you mean: