-
Notifications
You must be signed in to change notification settings - Fork 512
PS extension sets execution policy? #2404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PS extension sets execution policy? #2404
Comments
We already start with |
The integrated terminal should follow the machine settings, it's frustrating having to set the policy each time. New (powershell) terminals created do use the correct execution settings, no reason for the integrated one to be different. |
Ok I've played with this a bit now. It's not trivial. When we start PSES, we're forced to run it with execution policy So the remaining solution is to remember the initial execution policy and transmit that. The problem there is that the starting process is node, rather than PowerShell, meaning we'd need to start another PowerShell process to discover the execution policy, leading to greater startup time cost. Increasing startup time is something I'm fairly reluctant to do, since it's already a pain point. But I'm not sure what other avenues are available to us to fix this. |
You can query the other scopes in the same process, so running something like below before we run profiles could work. $userPolicy = Get-ExecutionPolicy -Scope User
if ($userPolicy -ne [Microsoft.PowerShell.ExecutionPolicy]::Undefined) {
Set-ExecutionPolicy -Scope Process -ExecutionPolicy $userPolicy -Force
return
}
$machinePolicy = Get-ExecutionPolicy -Scope Machine
Set-ExecutionPolicy -Scope Process -ExecutionPolicy $machinePolicy -Force Does really make me wish setting it to Anyway, still not free, but cheaper than starting another process. |
I was just having a similar thought! I’ll keep plugging on this |
I've been hitting an issue where I couldn't debug scripts because, even though my execution policy was set machine-wide to
Bypass
, my integrated console was reportingRemoteSigned
.It looks like this is set here but I'm not sure why. Shouldn't we just inherit the right execution policy?
The text was updated successfully, but these errors were encountered: