使用 Powershell 脚本调用 Mirth Connect CLI
Invoking Mirth Connect CLI with Powershell script
我正在使用 powershell 4 调用 Mirth Connect command line interface (mccommand.exe)。我明确避免使用 Mirth CLI 的“-s”参数来传递 Mirth 脚本文件,因为我想将动态命令传递给 Mirth Shell.
当我从交互式 powershell 控制台调用 mccommand.exe 时,我能够连接到 Mirth Connect 服务器并且 Mirth Shell 打开,我可以在其中 运行 一个或多个 Mirth Shell 管理欢乐频道的命令。
示例:
. "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 脚本中执行相同的命令时,我收到了相同的 "Connected to Mirth Connect server @ https://localhost:8443 (3.4.1.8057)" 消息,但脚本等待并且我从未收到“ $" 命令提示符,允许我将 Mirth Shell 命令传递给 Mirth。
关于如何通过 Powershell 脚本将命令路由到 Mirth Shell 有什么想法吗?
因此您必须将所有欢笑 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 包装器。到目前为止,只在 Mirth 3.6 上真正测试过,并用 PowerShell v5.1 编写,这是 Windows10 附带的默认设置。这使您可以编写可以执行 Mirth 管理控制台可以执行的任何操作的 PowerShell 脚本。
我正在使用 powershell 4 调用 Mirth Connect command line interface (mccommand.exe)。我明确避免使用 Mirth CLI 的“-s”参数来传递 Mirth 脚本文件,因为我想将动态命令传递给 Mirth Shell.
当我从交互式 powershell 控制台调用 mccommand.exe 时,我能够连接到 Mirth Connect 服务器并且 Mirth Shell 打开,我可以在其中 运行 一个或多个 Mirth Shell 管理欢乐频道的命令。
示例:
. "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 脚本中执行相同的命令时,我收到了相同的 "Connected to Mirth Connect server @ https://localhost:8443 (3.4.1.8057)" 消息,但脚本等待并且我从未收到“ $" 命令提示符,允许我将 Mirth Shell 命令传递给 Mirth。
关于如何通过 Powershell 脚本将命令路由到 Mirth Shell 有什么想法吗?
因此您必须将所有欢笑 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 包装器。到目前为止,只在 Mirth 3.6 上真正测试过,并用 PowerShell v5.1 编写,这是 Windows10 附带的默认设置。这使您可以编写可以执行 Mirth 管理控制台可以执行的任何操作的 PowerShell 脚本。