1

I am trying to get queue depth for remote IBM MQ using PowerShell script/commands. Seems it is not working correctly, please help.

{
$myremoteconns = New-WMQQmgrConnDef -Name T.test.TEST.QM1 -Hostname abcd_testhost01 -Port 1111 -Channel T.test.MQMQ.TESTCHN

$qm = Get-WMQQueueManager -Connections $myremoteconns | where {$_.Name -like 'T.test.TEST.QM1'} 

Error New-WMQQmgrConnDef the term 'New-WMQQmgrConnDef' is not recognized

Already installed WebSphere MQ - Windows PowerShell Library from below.

http://www-01.ibm.com/support/docview.wss?uid=swg24017698

Thanks

JoshMc
  • 10,239
  • 2
  • 19
  • 38
sachin bhomale
  • 61
  • 2
  • 12

1 Answers1

0

This error means that PowerShell cannot find this cmdlet. You need to check if the module you installed is properly found by PowerShell. Check this first:

Get-Module -ListAvailable

The result will be like:

PS C:\Users\username\PowerShell> get-module -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.0.1      ImportExcel                         {Import-Html, ConvertFrom-ExcelSheet, PieChart, Import-UPS...}

If you don't find the module on the list you can import it manually using:

Import-Module -Name 'C:\path\to\module.psm1'

In PowerShell (starting at V3) modules should be imported automatically if they are inside on of the path specified in environment variable PSModulePath. You can check its value by using:

$env:PSModulePath

Once you know which folders are included in this variable you can either move the module there or just add another path using

$env:PSModulePath = $env:PSModulePath + ";c:\path\to\module"

This will work for current session. If you want to modify it for all session you can add the line below to PowerShell profile.

More info:

Robert Dyjas
  • 4,979
  • 3
  • 19
  • 34
  • Hi Robdy , I imported all required modules and now got new error . {+ CategoryInfo : InvalidData: (:) [Get-WMQQueueManager], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,WebSphereMQ.GetWMQQueueManager} – sachin bhomale Jun 20 '18 at 04:44
  • That means you're providing incorrect data to the cmdlet. Check the documentation and `Get-Help` and [this website](https://hursleyonwmq.wordpress.com/2007/12/10/getting-your-websphere-mq-objects-in-the-powershell-next-gen-command-line/). Your question is now related to specific module, which I'm not using so it'd be difficult to resolve it for me. – Robert Dyjas Jun 20 '18 at 06:35
  • Thanks Robdy , I already checked same website and trying to figure out my mistake . Anyone else with MQ information , please help – sachin bhomale Jun 20 '18 at 12:42
  • I want to monitor queue depth for remote queue using powershell . – sachin bhomale Jun 21 '18 at 08:57
  • I'd suggest you to ask a new question (you may want to have a look at [this article](https://stackoverflow.com/help/how-to-ask) as comments are not really good place to look for answers. By the way, if you feel that my answer resolved your issue (with `Error New-WMQQmgrConnDef the term 'New-WMQQmgrConnDef' is not recognized`) feel free to mark it as [accepted answer. More info here.](https://stackoverflow.com/help/accepted-answer) – Robert Dyjas Jun 21 '18 at 09:05
  • Thanks , Added new one . – sachin bhomale Jun 21 '18 at 13:06