使用Powershell查看MSMQ传出队列?

时间:2018-02-15 20:48:20

标签: powershell msmq

我正在尝试使用Powershell查看传出的私有队列。它不一定是纯粹的" powershell,它可以被包装.net代码 - 我只是不知道如何做到这一点,所以请把它做成我可以在PowerShell脚本中运行的东西。

我可以成功查询普通的私人队列:

$msmq = Get-MsmqQueue -Name "myqueuename" 

$var = Receive-MsmqQueue -input $msmq -Peek -Count 5000 -Timeout 5000 -RetrieveBody 

但是,从出局队列中获取详细信息是不同的。而不是get-msmqqueue,你必须使用Get-MsmqOutgoingQueue,但这不适用于receive-msmqqueue:

> Receive-MsmqQueue -input $msmq -Peek 

Receive-MsmqQueue : Cannot bind parameter 'InputObject'. Cannot convert the "Microsoft.Msmq.PowerShell.Commands.OutgoingQueue" value of type 
"Microsoft.Msmq.PowerShell.Commands.OutgoingQueue" to type "Microsoft.Msmq.PowerShell.Commands.MessageQueue".
At line:1 char:26
+ Receive-MsmqQueue -input $msmq -Peek
+                          ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Receive-MsmqQueue], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Msmq.PowerShell.Commands.ReceiveMSMQQueueCommand

A different Stack Overflow thread说:

  

传出队列不是真正的队列,但可以看作是"列表   消息,按照他们预定的队列分组"。

但是,我不知道你如何获得一般的消息列表"它指的是。

任何帮助都非常感谢!

0 个答案:

没有答案
相关问题