2

Does anybody know how to read the user\group access permissions from an MSMQ private queue in powershell? I'd like to do this as a sanity check for my deployment script that installs NServiceBus services to make sure the service user actually has read access to the appropriate queue before installing the service.

From the documentation on the System.Messaging.MessageQueue class it seems like there are plenty of methods to set permissions for a queue, but no methods to get the permissions.

Any help is greatly appreciated!

-Jake

Jake Levitt
  • 120
  • 1
  • 9

1 Answers1

1

There is no .net method to retrieve actual ACL on a msmqueue.

You need to do some P/invoke::MQGetQueueSecurity

Here c# code to add-type in powershell::pinvoke.net

CB.
  • 58,865
  • 9
  • 159
  • 159
  • Thanks for the response... That was kind of what I was expecting, but hoping to avoid. My only other thought is that I might try to impersonate the service user and do a peek on the queue, then catch any errors. – Jake Levitt Apr 16 '12 at 19:01
  • 1
    I finally got around to writing a small library to solve this problem. https://github.com/jlevitt/MSMQSecurity – Jake Levitt Aug 17 '12 at 21:55