Unable to enumerate clustered MSMQ Queues using PowerShell or C# console application

David Downing 701 Reputation points
2021-07-22T17:45:14.713+00:00

I'm trying to use the following MSMQ PowerShell CmdLets to access the Clustered MSMQ Queues:

Get-MSMQQueue
Get-MSMQQueueACL

I've tried running the scripts from both the active and standby nodes of the cluster and I'm not able to see the queueus or ACLs.

I've also set the environment variables as follows before running with the same result.

$env:computername = "MsmqHostName"
$env:_CLUSTER_NETWORK_NAME_='MsmqHostName'
$env:_CLUSTER_HOST_NAME_='MsmqHostName'

As well as:

$env:CLUSTER_NETWORK_NAME='MsmqHostName'
$env:CLUSTER_HOST_NAME='MsmqHostName'

In addition; I developed a C# console app using P/Invoke of the MSMQ related APIs.

I am able to enumerate the queues and ACLs for local MSMQ, but I'm not able to enumerate them for the clustered queues.

Anyone know what I can do to enumerate the clustered queues using either PowerShell or from my C# console application?

Thank you.

Windows Server Clustering
Windows Server Clustering
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Clustering: The grouping of multiple servers in a way that allows them to appear to be a single unit to client computers on a network. Clustering is a means of increasing network capacity, providing live backup in case one of the servers fails, and improving data security.
950 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,322 questions
{count} votes

Accepted answer
  1. David Downing 701 Reputation points
    2021-07-23T21:44:56.083+00:00

    I was able to enumerate the queues and ACLs using the messaging APIs from a C# console application. To get the ACLs; I had to use P/Invoke on the platform APIs.

    Calling the MSMQ APIs for clustered queues/ACLs does require the '_CLUSTER_NETWORK_NAME_' environment variable to be set to the cluster host name. (NOTE: CLUSTER_NETWORK_NAME is prefixed and suffixed with '_')

    Because the server is running Windows Server 2012, I suspect the PowerShell scripts may not work.

    In Windows Server 2019, there are Failover Cluster Management Tools PowerShell extensions that may work.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Rich Matheisen 44,416 Reputation points
    2021-07-22T21:25:12.857+00:00

    Does any of this help?

    clustering-msmq-applications-rule-1

    0 comments No comments

  2. Yuhan Deng 3,761 Reputation points Microsoft Vendor
    2021-07-23T01:49:29.217+00:00

    Hi David,
    Not sure if this works but maybe you can have a look:
    https://learn.microsoft.com/en-us/powershell/module/msmq/?view=windowsserver2019-ps

    Thanks for your time.
    Best Regards,
    Danny

    -----------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments