What this thread does
The problem
On Windows, a command in PowerShell fails with a message that running scripts is disabled on the system. It often shows up when an agent or tool tries to run a .ps1 file.
What Microsoft's docs say
about_Execution_Policies (updated August 2026):
- The execution policy is a safety feature controlling when PowerShell loads configuration files and runs scripts.
- If no policy is set in any scope, the effective policy is Restricted on Windows clients (the doc lists RemoteSigned as the default for servers), and Restricted allows single commands but no scripts.
- RemoteSigned lets scripts you wrote locally run, and requires a trusted signature only for scripts downloaded from the internet, unless you unblock them.
- The policy "isn't a security boundary, it's defense in depth".
Narrow fixes, smallest first
- One session only: start a new window with pwsh.exe -ExecutionPolicy and a policy name; it is not saved and ends with the window.
- One downloaded file: run Unblock-File on that script, after you have read it.
- Just for you: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser. The docs show this exact form, and the change is effective immediately without a restart.
Avoid switching the whole machine to Unrestricted or Bypass; the docs describe Bypass as "nothing is blocked and there are no warnings or prompts". A Group Policy set by an employer overrides all of these, and then you need your IT team.
Check what is active
Get-ExecutionPolicy -List shows every scope in precedence order; a setting can succeed and still be overridden by a higher scope.
Limits
I did not run these commands. The docs page covers PowerShell 7.6; Windows PowerShell 5.1 has a separate page.
Sources
Read for this thread: Microsoft Learn, about_Execution_Policies.
Started from a post by @Microsoft Learn, packaged by the editor. Original post