简体   繁体   English

群集专用MSMQ队列上的设置权限

[英]Setpermission on clustered private MSMQ queue

I am trying to allocate additional permissions to a private clustered MSMQ queue. 我正在尝试将其他权限分配给专用群集MSMQ队列。

I found How to set permissions on MSMQ Cluster queues? 我发现了如何在MSMQ群集队列上设置权限? which is the same problem but I can't get it to work. 这是同样的问题,但我无法正常工作。

The key from that article is to set the environment variable: 该文章的关键是设置环境变量:

$env:_CLUSTER_NETWORK_NAME_ = 'myclusterMSMQ'

But what should myclusterMSMQ contain? 但是myclusterMSMQ应该包含什么?

In my case I have a cluster MSMQCluster with two nodes MSMQNodeA and MSMQNodeB . 在我的情况下,我有一个群集MSMQCluster其中包含两个节点MSMQNodeAMSMQNodeB The queue is in a clustered resource QueueResource . 队列位于群集资源QueueResource

The logical to me is to set it to QueueResource , but when I did that, the permission appeared on a queue with the same name on MSMQNodeA ... this is where I am running my powershell and it is the resource owner - the queue shouldn't be here but during script testing a queue with that name ended up here too. 对我而言,合乎逻辑的是将其设置为QueueResource ,但是当我这样做时,权限出现在MSMQNodeA上具有相同名称的队列中……这是我运行MSMQNodeA地方,它是资源所有者-队列不应不在这里,但是在脚本测试期间,具有该名称的队列也到了这里。

My code looks like this: 我的代码如下所示:

$queueUser= "domain\svc-account" 
$queueName=".\private$\log.queue"
$env:_CLUSTER_NETWORK_NAME_ = "$queueResource"
$queue = New-Object System.Messaging.MessageQueue $queueName
$queue.SetPermissions($queueuser, [System.Messaging.MessageQueueAccessRights]::WriteMessage)

I tried a variation that retrieved the queue using GetPrivateQueuesByMachine($queueResource) but that gave me the error: 我尝试了一种使用GetPrivateQueuesByMachine($queueResource)检索队列的变体,但这给了我错误:

System.Messaging.MessageQueueException (0x80004005): The specified format name does not support the requested operation. System.Messaging.MessageQueueException(0x80004005):指定的格式名称不支持所请求的操作。 For example, a direct queue format name cannot be deleted 例如,不能删除直接队列格式名称

I am sure that this last method was returning the queue from the QueueResource because when I listed all queues, I didn't get any of the other garbage queues that are on MSMQNodeA . 我确定最后一个方法是从QueueResource返回队列,因为当我列出所有队列时,我没有得到MSMQNodeA上的任何其他垃圾队列。

How do I set additional queue permissions on a private clustered queue with Powershell? 如何使用Powershell在专用群集队列上设置其他队列权限?

It looks like it wasn't working in part because the service account had lost MSMQ admin permissions so it didn't matter what value I used when testing. 看来这部分无效,因为该服务帐户失去了MSMQ管理员权限,因此我在测试时使用什么值都没有关系。

The following is the correct syntax: 以下是正确的语法:

$env:_CLUSTER_NETWORK_NAME_ = $QueueResource

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM