Skip to content

Instantly share code, notes, and snippets.

@TravisTheTechie
Created February 11, 2010 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TravisTheTechie/301853 to your computer and use it in GitHub Desktop.
Save TravisTheTechie/301853 to your computer and use it in GitHub Desktop.
Grants rights to a given user for queues matching the regex.
#GetQueueOwnership
param
(
[string] $queueNameRegex,
[string] $userName
)
[Void][System.Reflection.Assembly]::LoadWithPartialName("System.Messaging")
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("localhost") |
? {$_.QueueName -match $queueNameRegex} |
#% { Write-Host $_.QueueName }
% {$_.SetPermissions($userName, [System.Messaging.MessageQueueAccessRights]::FullControl, [System.Messaging.AccessControlEntryType]::Set);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment