7

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 to create a public or privet queue through the GUI. But when I come to try access the queue locally on the server through PowerShell (2.0) none of the Cmdlet's for MSMQ are recognized within the shell.

Are there any further steps that I need to take to access MSMQ through PowerShell? Is there a MSMQ module that I need to load?

Any advice on this would be appreciated.

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
Richard
  • 6,812
  • 5
  • 45
  • 60

3 Answers3

5

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.

IWillScoop
  • 258
  • 8
  • 17
Mike Shepard
  • 17,466
  • 6
  • 51
  • 69
  • arr I see what I have done now, I have found the correct syntax's thanks. – Richard Jul 12 '13 at 08:11
  • Actually, Mike, _your_ link is for pre-release 4.0, but Richard's link is clearly for PowerShell 3--but _only_ for Win Server 2012 and Win 8, hence his issue... which happens to be my issue as well, as posted [here](ttp://serverfault.com/q/534991/14413). – Michael Sorens Sep 11 '13 at 17:12
  • I don't see PowerShell versions on either of those pages, which makes me think that they were updated since the original answer. – Mike Shepard Sep 11 '13 at 19:12
  • "up one level in the link" ? where? http://pix.toile-libre.org/upload/original/1436237816.png – Alex Gordon Jul 07 '15 at 02:57
4

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"

Sean Anderson
  • 614
  • 8
  • 20
0

I would like to add, i had this error, but with version 5 in windows serveur 2019. I went to check Computer managment, Services and Applications, and there was not a section names Message Queuing. Which would explain why i cannot run the command line.

https://learn.microsoft.com/en-us/dotnet/framework/wcf/samples/installing-message-queuing-msmq

i had to restart my computer after that. A pop up tells you to do so.

Sophie
  • 324
  • 3
  • 12