从power-shell命令/脚本进行远程IBM MQ监视

时间:2018-06-19 06:03:20

标签: powershell ibm-mq

我正在尝试使用PowerShell脚本/命令获取远程IBM MQ的队列深度。似乎它工作不正常,请帮忙。

{
$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'} 
  

错误New-WMQQmgrConnDef无法识别术语'New-WMQQmgrConnDef'

已经安装了WebSphere MQ - 来自下面的Windows PowerShell库。

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

谢谢

1 个答案:

答案 0 :(得分:0)

此错误表示PowerShell无法找到此cmdlet。您需要检查PowerShell是否正确找到了您安装的模块。先检查一下:


from rest_framework.authentication import TokenAuthentication


@api_view(['GET'])
@authentication_classes((SessionAuthentication, TokenAuthentication, BasicAuthentication))
@permission_classes((IsAuthenticated,))
def auth_test(request):
    return Response("it's great to have you here with token auth!!")

结果如下:

Get-Module -ListAvailable

如果您在列表中找不到该模块,可以使用以下方法手动导入:

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...}

在PowerShell中(从V3开始),如果模块位于环境变量Import-Module -Name 'C:\path\to\module.psm1' 中指定的路径内,则应自动导入模块。您可以使用以下方法检查其值:

PSModulePath

一旦您知道此变量中包含哪些文件夹,您可以将模块移动到那里或只使用

添加其他路径
$env:PSModulePath

这适用于当前会话。如果要为所有会话修改它,可以将以下行添加到PowerShell配置文件中。

更多信息: