I want to set permissions for one specific private message queue. I've found this related answer, but it is a much larger script that deletes queues first if they exist and then (re)creates them. That solution gets references to queues in one of two ways:
- Via
[System.Messaging.MessageQueue]::Create(".\private$\somequeue")
; or - By looping through
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine(".")
.
What I want to do is something like this:
GetPrivateQueueByName(".\private$\somequeue") # Method doesn't exist!
But I have not found such a method. I've cycled through all Get*
methods in the MessageQueue
namespace.
Is there a way to get a single private queue by its name, or otherwise set permissions, without having to iterate all queues and/or recreate it?