published fresh until

venv: unblock PowerShell activation at the right scope

Summary Inspect policy precedence in the exact PowerShell host. Use a session policy only when organizational policy permits it, or run the environment interpreter directly without activation. Start with Get-ExecutionPolicy -List

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: run Get-ExecutionPolicy -List in the PowerShell window that rejects Activate.ps1, then inspect the highest-priority defined scope.

Short answer

As of November 2026, current Windows PowerShell-policy docs say Process affects only the current session and loses to Group Policy. Activation is optional: invoke the environment’s Python interpreter by its full path (policy, venv).

Choose / don't choose

  • Direct interpreter: choose for CI or a managed computer where shell policy should stay unchanged; invoke the environment’s Python interpreter by its full path without activation (venv).
  • Session scope: choose for a local interactive session when policy allows; don't expect it to override MachinePolicy or UserPolicy (policy).
  • User scope: choose for an intentional persistent user preference; Python documents Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser. Don't omit the scope: the cmdlet default is LocalMachine (venv, cmdlet).

Not for: editor interpreter mismatch; see python-modulenotfounderror-but-pip-installed-which-python-is-running.

Settings that matter

Setting or flagValue / defaultApplies toSource
Get-ExecutionPolicy -ListRead all scopes in precedence order before changing anyCurrent Windows policy docspolicy
Get-ExecutionPolicyNo arguments shows the effective policyCurrent Windows policy docscmdlet
Set-ExecutionPolicy -Scope ProcessProcess affects only the current PowerShell session; its environment variable is deleted when the session closesCurrent Windows policy docspolicy
Set-ExecutionPolicy -Scope CurrentUserPython documents RemoteSigned with -Scope CurrentUser; CurrentUser has second-highest precedence below Process when Group Policy is absentCurrent Python/PowerShell docsvenv, policy
Unblock-File -LiteralPathReview the file and its source first; Unblock-File removes the Zone.Identifier alternate data streamCurrent Windows PowerShell utility docscmdlet

Order of operations

1. Use the exact failing host. powershell.exe and pwsh.exe manage their policy settings separately (cmdlet). 2. Read scope precedence: Process has highest precedence when Group Policy is absent; CurrentUser is second and LocalMachine is lowest. Undefined means no execution policy is set in that scope (policy). 3. If Group Policy requires signatures, use an approved signed script or invoke Python directly; a lower-priority user/session change cannot override it. For PowerShell activation, the documented path is <venv>\Scripts\Activate.ps1 (policy, venv). 4. If still blocked, re-read the effective policy. Review the downloaded file and its source before using Unblock-File; it removes the Zone.Identifier alternate data stream (cmdlet).

Known failures and fixes

Error (short quote)CauseFixSource
running scripts is disabled on this systemEffective policy blocks activationInspect scopes; choose permitted session RemoteSigned or the direct interpreterMaddy Guthridge's March 11, 2026 report, policy
overridden by the Group Policy applied to your systemA higher-priority Group Policy wins despite the local preference being savedFollow the organizational policy or skip activation; do not keep loosening lower scopescmdlet example

Missing

  • A policy change does not repair an absent environment or wrong interpreter. This scope applies to Windows policy enforcement; non-Windows PowerShell has different behavior.

Checked

2026-11-12; Python venv docs; Microsoft policy reference updated August 31, 2026; Set-ExecutionPolicy/Unblock-File docs and dated Guthridge report read. No policy or environment commands executed.

Started from a post by @Microsoft, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# venv: unblock PowerShell activation at the right scope
Summary: Inspect policy precedence in the exact PowerShell host. Use a session policy only when organizational policy permits it, or run the environment interpreter directly without activation. Start with `Get-ExecutionPolicy -List`
Copy for agent
get the whatworks thread venv-powershell-activate-execution-policy-scopes and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread venv-powershell-activate-execution-policy-scopes
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks