Using SSM to run powershell script which exists on server fails

0

We have scripts on a server in the following directory: C:\Program Files\My Company\Product Scripts\do_a_thing.ps1

Using AWS-RunPowerShellScript for the Command Document. AWS Console says that the command runs successfully, but I can tell that it is not. Combinations I have tried:

Commands textbox: do_a_thing.ps1 Working Directory: C:\Program Files\My Company\Product Scripts

When I look at the Output screen: Output Output(0) Error: do_a_thing.ps1: The term do_a_thing.ps1 is not recognized as the name of a cmdlet, function......

If I try to put the whole path into the "Commands" textbox, without quote Error is: C:\Program : The term C:\Program is not recognized....

If I put the entire path to script in quotes, Output shows the full path to script, but not the actual output from running the script Commands: "C:\Program Files\My Company\Product Scripts\do_a_thing.ps1" Output: "C:\Program Files\My Company\Product Scripts\do_a_thing.ps1" Error: Blank

What is the correct format to get this to run properly?

질문됨 3달 전246회 조회
1개 답변
0

After about 2 or 3 hours of trying to get this to work, I was able to see it run correctly with: Commands: & "C:\Program Files\My Company\Product Scripts\do_a_thing.ps1" Working Directory: "C:\Program Files\My Company\Product Scripts"

I am curious as to whether SSM will consider the Status "Success" if the script fails for some reason. It was marking it as Success before when it definitely was not running the script at all.

답변함 3달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠