Skip to content

System-wide ExecutionPolicy 'Bypass' setting causes host process crash #192

@daviwil

Description

@daviwil

Copied from vscode-powershell issue: PowerShell/vscode-powershell#119

Details from @ftischhauser:

When setting the execution policy to 'Bypass' using the machine policy, the PS host fails to start with the following error:

Unhandled Exception: System.Management.Automation.CmdletInvocationException: Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of Bypass

To reproduce the issue you can set the following registry values:

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell]
"EnableScripts"=dword:00000001
"ExecutionPolicy"="Bypass"

As this is the least restrictive setting the host should work just fine and catch this error.

Thanks for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions