Get remote MSMQ object using 'Get-MsmqQueue' in Powershell 4
<p>I am trying to get the MessageQueue object to return in order to add messages to it via Powershell 4.0 cmdlet: </p>

<pre><code>Get-MsmqQueue
</code></pre>

<p>If I am locally on the server with the message queue, I can run the following and an object of type <code>MessageQueue</code> is returned:</p>

<pre><code>Get-MsmqQueue -Name "myQueueName"
</code></pre>

<p>Now if I'm on another server where the script needs to live, I can't seem to get the MessageQueue object to return. I've tried plenty of different combinations of single and double quotes, different flags, etc.</p>

<pre><code>Get-MsmqQueue -Name 'myServerName.myCompany.com\private$\myQueueName'
Get-MsmqQueue -Name 'myServerName\private$\myQueueName'
Get-MsmqQueue -Name 'FormatName:DIRECT=OS:myServerName.myCompany.com\private$\myQueueName'
Get-MsmqQueue -Name 'FormatName:DIRECT=OS:myServerName\private$\myQueueName'
Get-MsmqQueue -Name "FormatName:DIRECT=OS:myServerName\private$\myQueueName"
Get-MsmqQueue -Name 'FormatName:DIRECT=OS:myServerName\private$\myQueueName' -QueueType Private
</code></pre>

<p>Has anyone had any luck doing this? I'd really appreciate the help. Thanks in advance!</p>