shell - 使用 Powershell 脚本调用 Mirth Connect CLI

标签 shell powershell mirth

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

当我从交互式 powershell 控制台调用 mccommand.exe 时,我能够连接到 Mirth Connect 服务器和 Mirth Shell已打开,我可以在其中运行一个或多个 Mirth Shell 命令来管理 Mirth Channels。

例子:

. "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 服务器 @ https://localhost:8443 (3.4.1.8057)”消息,但脚本等待并且我从未收到“$”命令提示符,允许我将 Mirth Shell 命令传递给 Mirth。

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

最佳答案

因此您必须将所有 mirth shell 命令作为文本文件传递。 这就是我用来导入和部署任何 channel 的方式。

按照下面的代码:

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"

关于shell - 使用 Powershell 脚本调用 Mirth Connect CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38400543/

相关文章:

linux - 在远程机器上执行部分 shell 脚本

powershell - 使用Powershell生成SQL创建表脚本

mysql - Mirth Connect - 升级到版本 3 后删除 old_messages 表是否安全?

java - Mirth 定制网络服务

docker - 在 Docker 中调用 Mirth Connect CLI

bash - 在程序化 shell 命令执行中嵌入环境变量

bash - 验证从读取的 bash 中传递的参数数量

linux - curl - 在 shell 脚本内运行特殊字符 URL 时出现问题

powershell - 测试路径在应为true时返回false

security - 使用 powershell Set-GPPermissions cmdlet 设置 GPO 安全过滤器