Search code examples
c#powershellpermissionsmsmq

How can I give a user permissions to Create a new Queue in MSMQ


How can I programmatically using C# or PowerShell give permissions for a user to Create or Delete new message queues. You can do this in the UI by navigating to:

Computer Management -> Message Queueing -> Right Click Properties -> Security Tab

You see the UI below which has the 'Create Queue' permission.

enter image description here


Solution

  • In PowerShell there's a commandlet for this called Set-MsmqQueueACL. I've used it in provisioning message queues in deployment scripts before and it works well.

    You first create the Message Queue using New-MsmqQueue and then pipe that to the commandlet or select it later and send it using Get-MsmqQueue. Full documentation for these commandlets can be found on Microsoft's site - https://technet.microsoft.com/en-us/library/dn391735(v=wps.630).aspx