cancel
Showing results for 
Search instead for 
Did you mean: 

Get list of Private Queues using JavaScript

SOLVED
Highlighted
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?

1 ACCEPTED SOLUTION

Accepted Solutions
New Contributor

Re: Get list of Private Queues using JavaScript

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);
3 REPLIES 3
Frequent Contributor

Re: Get list of Private Queues using JavaScript

Hi, Does this helps? https://support.smartbear.com/testcomplete/docs/reference/program-objects/storages/registry.html
With Regards
Vallalarasu Pandiyan | LinkedIn |Vallalarasu.p@gmail.com
Community Hero

Re: Get list of Private Queues using JavaScript

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 Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Contributor

Re: Get list of Private Queues using JavaScript

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);
New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors