使用Powershell脚本调用Mirth Connect CLI

使用Powershell脚本调用Mirth Connect CLI,shell,powershell,mirth,Shell,Powershell,Mirth,我正在使用PowerShell4调用(mccommand.exe)。我明确避免使用Mirth CLI的“-s”参数来传递Mirth脚本文件,因为我希望将动态命令传递给Mirth Shell 当我从交互式powershell控制台调用mccommand.exe时,我可以连接到Mirth connect服务器,并打开,在那里我可以运行一个或多个Mirth Shell命令来管理Mirth频道 例如: . "C:\Program Files (x86)\Mirth Connect\mccommand.e

我正在使用PowerShell4调用(mccommand.exe)。我明确避免使用Mirth CLI的“-s”参数来传递Mirth脚本文件,因为我希望将动态命令传递给Mirth Shell

当我从交互式powershell控制台调用mccommand.exe时,我可以连接到Mirth connect服务器,并打开,在那里我可以运行一个或多个Mirth Shell命令来管理Mirth频道

例如:

. "C:\Program Files (x86)\Mirth Connect\mccommand.exe" -a "https://localhost:8443" -u admin_user -p admin_password
Connected to Mirth Connect server @ https://localhost:8443 (3.4.1.8057)
$
当我通过Windows powershell ISE从powershell脚本中运行相同的命令时,我会收到相同的“已连接到Mirth Connect server@(3.4.1.8057)”消息,但脚本会等待,我从未收到允许我将Mirth Shell命令传递给Mirth的“$”命令提示符


关于如何通过Powershell脚本将命令路由到Mirth Shell,您有什么想法吗?

因此,您必须将所有的Mirth Shell命令作为文本文件传递。 这就是我用来导入和部署任何通道的方法

请遵循以下代码:

Set-Location 'C:\Mirth Connect'
$ChannelOutput=.\mccommand.exe -a https://localhost:38443 -u username -p password -s "C:\commands.txt"

If($ChannelOutput -like '*successfully*')
{
"Channel created successfully and deplyed"
}
else
{
$_.Exception.Message
}
文本文件应具有如下命令集:

Commands.txt: 
 import "C:\TestServiceChannel1.xml" Force
channel deploy "Channel_name"

作为更新,我已经为Mirth REST API编写了一个PowerShell包装器。到目前为止,只在欢乐3.6上进行了真正的测试,并在PowerShell v5.1中编写,这是Windows 10附带的默认版本。这允许您编写PowerShell脚本,这些脚本可以完成Mirth管理控制台所能做的任何事情


不确定这是否有帮助,因为我无法测试它,但您可能希望使用call操作符(
&
)而不是dot操作符(它有不同的用途)。