Accessing MSMQ via PowerShell

后端 未结 2 590
春和景丽
春和景丽 2021-01-12 18:41

I have installed the MSMQ feature onto both server (win 2008 R2) and client machine (win 7) using the following Link. The Feature appears in the server manager and I am able

相关标签:
2条回答
  • 2021-01-12 19:10

    The below method works in Powershell 2.0:

    $query = "SELECT MessagesinQueue FROM Win32_PerfRawData_MSMQ_MSMQQueue WHERE Name = 'myPrivateQueueName'"
    $wmiObject = Get-WmiObject -Query $query
    $wmiObject.MessagesinQueue
    

    You can list the queues with this query:

    $query = "SELECT * FROM Win32_PerfRawData_MSMQ_MSMQQueue"
    

    Look at the __PATH property which will end in .Name="theQueueName"

    0 讨论(0)
  • 2021-01-12 19:20

    If you click up one level in the link you provided you'll see that you're looking at pre-release PowerShell 4.0 module documentation. Here's the link to the parent page.

    https://web.archive.org/web/20131029215718/http://technet.microsoft.com/en-us/library/dn249523.aspx

    PowerShell Community Extensions (PSCX) has some cmdlets for working with MSMQ, and it works with PowerShell 2.0, though.

    0 讨论(0)
提交回复
热议问题