Skip to content

Powershell task factory execution policy issue#98

Open
professor-k wants to merge 3 commits intomikefourie-zz:releases/4.0from
professor-k:releases/4.0
Open

Powershell task factory execution policy issue#98
professor-k wants to merge 3 commits intomikefourie-zz:releases/4.0from
professor-k:releases/4.0

Conversation

@professor-k
Copy link
Copy Markdown

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: michaelburns/LaunchPad#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.

@professor-k
Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant