1
votes

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

1

1 Answers

0
votes

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: