Open professor-k opened 3 years ago
p.s. It appeared that it was impossible to intercept "Write-Host" calls the way I did it first time. Bit more of stackoverflowing brought me to what is currently recommended way of in-app hosting of a script (https://docs.microsoft.com/en-us/powershell/scripting/developer/hosting/windows-powershell-host-quickstart?view=powershell-7.1). I updated the task template accordingly. Works like a charm now.
I stumbled upon the fact that powershell task factory has issues with execution policy when run on Windows 10. Basically, it won't run even if machine has them completely turned off. Some people encountered similar issue on similar code: https://github.com/michaelburns/LaunchPad/issues/5 There is reference to the blog post in that issue, sadly it's dead already. I'm not powershell expert, but just mimicking their solution worked for me. While at it I also looked up how to intercept outputs from powershell pipeline and added respective code.