Set-MsmqQueueACL - Allow - can't use list as per docs?

前端 未结 1 628
北海茫月
北海茫月 2021-01-13 07:52

I\'m trying to set ACL on a Msmq Queue using Powershell v5.1 (Win2k16) - but even though I\'m following the documentation - I keep getting an error.

Get-Msmq         


        
相关标签:
1条回答
  • 2021-01-13 08:29

    The docs are likely missing quotes; it's expecting an enum that supports bitfields, so most likely you'd do it like this (I don't have the msmq cmdlets or types on my 2016 PS 5.1 boxes so I can't test), using bitwise or:

    $allows = [Microsoft.Msmq.PowerShell.Commands.MessageQueueAccessRights]::Peek -bor
              [Microsoft.Msmq.PowerShell.Commands.MessageQueueAccessRights]::Send -bor
              [Microsoft.Msmq.PowerShell.Commands.MessageQueueAccessRights]::Receive
    
    Set-MsmqQueueAcl -UserName "REDMOND\madmax" -Allow $allows
    

    It should work by putting all the values in quotes (that is, not an array, a string with commas in it), but you said you tried it that way and it didn't work; did that produce a different error?

    0 讨论(0)
提交回复
热议问题