小编Bat*_*ice的帖子

MSMQ 发布消息

我是 PowerShell 的完全新手,但一直在研究测试我设置的消息队列 (MSMQ) 的最佳方法。到目前为止,我已经能够在 Powershell 中运行以下命令来获取我的所有队列以查看存在的内容:

gwmi -class Win32_PerfRawData_MSMQ_MSMQQueue -computerName . |
ft -prop Name, MessagesInQueue
Run Code Online (Sandbox Code Playgroud)

这将返回我可用的 MSMQ 队列列表。我现在只想向返回的队列之一发布消息以测试连接。我的队列被命名为:

<server>\private$\<queuename>
Run Code Online (Sandbox Code Playgroud)

我曾尝试使用以下方法但没有运气:

$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
Run Code Online (Sandbox Code Playgroud)

我一生都无法弄清楚如何做到这一点。有没有人有任何好的资源或代码来做到这一点?

powershell msmq

2
推荐指数
1
解决办法
1702
查看次数

标签 统计

msmq ×1

powershell ×1