作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Powershell v5.1 (Win2k16) 在 Msmq 队列上设置 ACL - 但即使我正在关注文档 - 我仍然收到错误消息。
Get-MsmqQueue -Name "s009_ClientsServiceBus" -QueueType Private | Set-MsmqQueueAcl -UserName "domain.com\WfxServiceBus" -Allow Peek,Write
Set-MsmqQueueACL : Cannot convert 'System.Object[]' to the type
'System.Nullable`1[Microsoft.Msmq.PowerShell.Commands.MessageQueueAccessRights]' required by parameter 'Allow'. Specified method is
not supported.
At line:1 char:128
+ ... t-MsmqQueueAcl -UserName "domain.com\WfxServiceBus" -Allow Peek,Write
+ ~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-MsmqQueueACL], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Msmq.PowerShell.Commands.SetMSMQQueueACLCommand
Get-MsmqQueue –Name Order* –QueueType Private | Set-MsmqQueueAcl –UserName “REDMOND\madmax” –Allow Delete,Peek,Receive,Send –Deny TakeOwnership
PS C:\Users\user> Get-MsmqQueue -Name Order* -QueueType Private | Set-MsmqQueueAcl -UserName "REDMOND\madmax" -Allow Delete,Peek,Receive,Send -Deny TakeOwnership
Set-MsmqQueueACL : Cannot convert 'System.Object[]' to the type
'System.Nullable`1[Microsoft.Msmq.PowerShell.Commands.MessageQueueAccessRights]' required by parameter 'Allow'. Specified method is
not supported.
At line:1 char:100
+ ... cl -UserName "REDMOND\madmax" -Allow Delete,Peek,Receive,Send -Deny T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-MsmqQueueACL], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Msmq.PowerShell.Commands.SetMSMQQueueACLCommand
.... -Allow "Peek,Send"
.... -Allow "Peek","Send"
.... -Allow 'Peek,Send'
PS C:\Users\meaton> Get-MsmqQueue -Name "s009_ClientsServiceBus" -QueueType Private | Set-MsmqQueueAcl -UserName "domain.com\WfxServic
eBus" -Allow "Peek,Write"
Set-MsmqQueueACL : Cannot bind parameter 'Allow'. Cannot convert value "Peek,Write" to type
"Microsoft.Msmq.PowerShell.Commands.MessageQueueAccessRights". Error: "Unable to match the identifier name Peek,Write to a valid
enumerator name. Specify one of the following enumerator names and try again:
DeleteMessage, PeekMessage, ReceiveMessage, WriteMessage, DeleteJournalMessage, ReceiveJournalMessage, SetQueueProperties,
GetQueueProperties, DeleteQueue, GetQueuePermissions, GenericWrite, GenericRead, ChangeQueuePermissions, TakeQueueOwnership,
FullControl"
At line:1 char:128
+ ... MsmqQueueAcl -UserName "domain.com\WfxServiceBus" -Allow "Peek,Write"
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-MsmqQueueACL], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Msmq.PowerShell.Commands.SetMSMQQueueACLCommand
...Set-MsmqQueueACL : Cannot bind parameter 'Allow'. Cannot convert value "PeekMessage,WriteMessage" to type
"Microsoft.Msmq.PowerShell.Commands.MessageQueueAccessRights" due to enumeration values that are not valid. Specify one of....
最佳答案
文档可能缺少引号;期待 an enum that supports bitfields ,所以很可能你会这样做(我的 2016 PS 5.1 机器上没有 msmq cmdlet 或类型,所以我无法测试),使用按位 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
关于powershell - Set-MsmqQueueACL - 允许 - 不能按照文档使用列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43596766/
我正在尝试使用 Powershell v5.1 (Win2k16) 在 Msmq 队列上设置 ACL - 但即使我正在关注文档 - 我仍然收到错误消息。 Get-MsmqQueue -Name "s0
我是一名优秀的程序员,十分优秀!