0

I have a Powershell script which I'm trying to implement on a website with PHP's shell_exec.

The script will usually complete on it's own without the need for user input. However in some rare cases, user input is needed. Read-Host is good when running the .ps1-file on its own, but with shell_exec the script will simply stop executing if it reaches Read-Host.

Is there a way to make a connection here and prompt for user input through HTML/PHP? Or do I have to rewrite?

I have googled for a while but didn't get any smarter.

Erik Erik
  • 45
  • 5
  • the `Read-Host` cmdlet requires an interactive session. most calls to run scripts do so in a _non-interactive_ session. i suspect you are seeing the result of a "waiting for input to invisible read request". [*grin*] – Lee_Dailey Oct 12 '20 at 16:33
  • If you're using the default console application (`powershell.exe`/`pwsh.exe`) via `shell_exec` then you'll have to rewrite, yes. – Mathias R. Jessen Oct 12 '20 at 18:16

0 Answers0