I\'m trying to execute a PowerShell script from a c# application. The script has to be executed under a special usercontext.
I\'ve tried different scenarios some are
I just spent the day fixing this for myself.
I finally was able to make it work by adding -Scope Process to Set-ExecutionPolicy
invoker.Invoke("Set-ExecutionPolicy Unrestricted -Scope Process");