When I put the http://localhost/cgi-bin/test.cgi into browsers address bar, the response is
Error 500
In the apache\logs\error.log is
[Thu Nov 30 18:20:29.215223 2017] [cgi:error] [pid 3548:tid 1680] [client ::1:55927] End of script output before headers: te
st.cgi
You’re VERY outside of PowerShell’s envisioned use cases, here - so it might never work the way you want. And I suspect it’ll be dog-slow if it does work.
But running PowerShell that way wouldn’t work anyway, I don’t think. First, you’ve just run PowerShell - you’ve not told it to do anything, like run a script. Second, I’m not really sure PowerShell would output to stdout in the way you’re thinking, although I’m not sure what you’re goal is, so I might be wrong on that.
Currently I use cmd scripts and Perl scripts to do some jobs. They are launched by clicking on a web page link or a button. For example one script zips a selected folder and lets the user to download it. But I have many other such scripts. I think Powershell is cleaner language, more “future” and natural in Windows. Currently run the .bat and .ps1 from Perl script, but it is not what I like to do. The test.ps1 script mentioned above should only write Hello in the browser - to test the concept.