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

David Downing 706 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 for business | Windows Server | Storage high availability | Clustering and high availability
Windows for business | Windows Server | User experience | PowerShell
{count} votes

Answer accepted by question author
  1. David Downing 706 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. Anonymous
    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

  2. Rich Matheisen 48,036 Reputation points
    2021-07-22T21:25:12.857+00:00

    Does any of this help?

    clustering-msmq-applications-rule-1

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.