So I have a PowerShell script on my aws windows server, and I'm trying to run that script through AWS Run Command. I've tried Start-Process C:\Path\NameOfPowerShellScript.ps1
. Unfortunately it doesn't work. What my code does is install java-jre on the server. Any help will be appreciated.PS Code runs fine locally.
Asked
Active
Viewed 644 times
0

Arvind Maurya
- 910
- 12
- 25

ADEKOLA ADELEKAN
- 1
- 1
-
Please (also) post your code, data, error messages as ([properly formatted](https://stackoverflow.com/help/formatting)) _text_, [not (just) as _images_](https://meta.stackoverflow.com/a/285557/45375). – mklement0 Jul 07 '22 at 01:55
-
You cannot use a `.ps1` file with `Start-Process`('s positionally implied `-FilePath` parameter) to _execute_ it - for that you'd need to use `powershell.exe` or `pwsh` with arguments `-File` and the script file path. However, unless you need to run in the script in a _child process_, in a _new window_, there's no reason to use `Start-Process`: just invoke the `.ps1` file _directly_. – mklement0 Jul 07 '22 at 01:58