1
当谈到PowerShell时,我是一个完全新手,但一直在研究测试我设置的消息队列(MSMQ)的最佳方法。 到目前为止,我已经能够在PowerShell中运行以下获得所有我的队列,看看有什么存在:MSMQ发布消息
gwmi -class Win32_PerfRawData_MSMQ_MSMQQueue -computerName . |
ft -prop Name, MessagesInQueue
这将返回MSMQ队列的名单上有可用。 我现在想要发送一条消息给只有一个返回的队列被命名来测试连接。我的队列被命名为:
<server>\private$\<queuename>
我曾尝试使用下面的尝试,但没有运气:
$myqueue = '.\Private$\portalemailqueue'
$MyQueue.Send("<<Message>>", "test1")
Method invocation failed because [System.String] does not contain a method named 'Send'.
At line:3 char:1
+ $MyQueue.Send("<<Message>>", "test1")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
我不能为我的生活弄清楚如何做到这一点。有没有人有任何好的资源或代码来做到这一点?