dbc680
6 years agoNew 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 registr...
- 6 years ago
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);