AWS系统管理器运行命令-在EC2实例上执行.exe文件



情况如下。我们有一个运行Windows的EC2实例,它每天使用Windows任务调度程序运行几个程序。我们希望使用AWS Systems Manager维护窗口来替换此设置。但在此之前,我想从小处入手,简单地使用Systems Manager run命令在EC2实例上运行一个exe。我能够针对我的实例,并且我知道必须编写定义命令的SSM文档,因此我尝试使用具有以下JSON文档结构的"aws:runPowerShellScript":

{
"schemaVersion": "2.2",
"description": "Scheduled Scripts Launcher",
"mainSteps": [
{
"action": "aws:runPowerShellScript",
"name": "run_script",
"inputs": {
"runCommand": [
"& 'C:/Users/Administrator/Desktop/sc/TestApp.exe'"
]
}
}
]
}

带有此文档的运行命令报告成功,但是目标实例上的程序没有运行。也许我根本无法以这种方式启动exe;欢迎提出任何建议。

找到了解决方案。有必要明确指定目录。所以这是在runCommand:下添加的

"workingDirectory": "C:/Users/Administrator/Desktop/sc"

最新更新