简体   繁体   中英

AWS Systems Manager Run Command - execute .exe file on EC2 instance

The situation is as follows. We have an EC2 instance running Windows that runs several programs daily using the Windows Task Scheduler. We would like to potentially replace this setup with AWS Systems Manager maintenance windows. But before that is possible I would like to start small and simply run an exe on an EC2 instance using Systems Manager Run Command. I am able to target my instance and I understand an SSM document must be written defining the Command, therefore I have tried using 'aws:runPowerShellScript' with the following JSON document structure:

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

A Run Command with this document reports being successful, however the program on the targeted instance does not run. Perhaps I cannot launch an exe this way at all; any pointers are welcome.

Found the solution. It was necessary to explicitly specify the directory. So this was added under runCommand:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM