To set the execution policy to Unrestricted, run Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser in PowerShell. It works, but it is rarely the right choice: RemoteSigned or a one-session Process scope gets scripts running with less exposure.
The command, in the three scopes you can change yourself:
# Only for your user account
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
# Only for the current PowerShell window
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
# For everyone on the computer (needs Run as Administrator)
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
The last form uses the default scope, LocalMachine. Per Microsoft's documentation, changing that scope requires starting PowerShell with Run as Administrator. The change takes effect immediately, with no restart. If PowerShell asks you to confirm, answer Y.
What Unrestricted actually does
Microsoft's description of Unrestricted has three parts. Unsigned scripts can run. There is a risk of running malicious scripts. And PowerShell warns you before it runs scripts and configuration files that are not from the local intranet zone. The cmdlet reference words the last part as a prompt: if you run an unsigned script that was downloaded from the internet, you are asked for permission before it runs.
Compare that with RemoteSigned. It also lets local scripts run, but it refuses unsigned scripts that carry the "downloaded from the internet" mark unless you unblock them. Unrestricted turns that refusal into a question. In practice, that means a script from a browser download or an email attachment is one keystroke away from running, where RemoteSigned would stop and make you act on the file first.
| Policy | Unsigned local script | Unsigned script downloaded from the internet |
|---|---|---|
RemoteSigned | Runs | Blocked until you run Unblock-File on it |
Unrestricted | Runs | Runs after a permission prompt |
Bypass | Runs | Runs with no warning or prompt |
The table is a summary of Microsoft's policy descriptions, not output from a command. Your machine may also apply other settings, such as a Group Policy, that change the result.
Is Set-ExecutionPolicy Unrestricted a security risk?
It is a smaller risk than its name suggests, and a bigger one than it needs to be. Both statements come from the same Microsoft page.
The smaller part: Microsoft states that the execution policy is not a security boundary, it is defense in depth. Someone who cannot run a script can paste its contents at the prompt instead. So a strict policy never stopped a determined attacker, and loosening it does not hand one a new capability. The policy exists to help people follow basic rules and avoid breaking them by accident.
The bigger part: accidents are exactly what the internet-download check guards against. You double-click or call a .ps1 file that arrived from somewhere you did not vet, and with Unrestricted the only barrier left is a prompt that is easy to confirm out of habit. RemoteSigned adds a hard stop that forces a deliberate step (reading the file, then unblocking it). If you set Unrestricted and leave it, you also keep that weaker state for every future script, not only the one that made you change it.
One more consideration is scope. A machine-wide Unrestricted setting applies to every account on the computer, including accounts that did not ask for it. Changing the policy for CurrentUser alone changes less.
Safer options than Unrestricted
RemoteSigned for your user
This is the setting most people actually need. It enables local scripts and keeps the internet-download check:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
For the full walkthrough, including how to undo it and why Group Policy can override it, see How to Enable Running Scripts in PowerShell.
Unblock the one file you trust
If a single downloaded script is blocked under RemoteSigned, you do not need a looser policy. Read the script first, then clear its internet mark:
Unblock-File -Path .\script.ps1
Microsoft's cmdlet reference calls reading the code before unblocking a best practice, and notes that Unblock-File does not change the execution policy at all. Scripts fetched with curl.exe, Invoke-RestMethod or Invoke-WebRequest may not carry the mark in the first place.
Unrestricted or Bypass for one session only
If you really do want Unrestricted, make it temporary. The Process scope keeps the value in memory, in $Env:PSExecutionPolicyPreference, and deletes it when the session closes:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
Process has the highest precedence of the three local scopes, so it beats whatever is saved for CurrentUser and LocalMachine. Nothing is written to a configuration file, so there is nothing to forget to undo. The same effect is available from the command line when you start a new session, using the -ExecutionPolicy parameter of pwsh.exe (Windows PowerShell 5.1 has the same parameter on powershell.exe):
powershell.exe -ExecutionPolicy Unrestricted -File .\script.ps1
The session policy affects only that session and its child sessions. It does not override a Group Policy.
Check which policy is really in effect
After any change, look at every scope in precedence order:
Get-ExecutionPolicy -List
This is Microsoft's sample output, shown here as example output only. Your values will differ:
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser RemoteSigned
LocalMachine AllSigned
The effective policy here is RemoteSigned, because CurrentUser outranks LocalMachine. Microsoft warns that a command to change the policy can succeed and still not change the effective policy. If you set Unrestricted on LocalMachine but your user already has a value, your user value wins. Use Get-ExecutionPolicy with no parameters to see the single effective value.
Set-ExecutionPolicy says it is overridden by Group Policy
The MachinePolicy and UserPolicy rows come from Group Policy, and they override every scope you can set from PowerShell. If you try, PowerShell saves your preference but reports the conflict. This is Microsoft's documented example of the message (example output):
Set-ExecutionPolicy : PowerShell updated your local preference successfully, but the setting is
overridden by the Group Policy applied to your system. Due to the override, your shell will retain
its current effective execution policy of "AllSigned". Contact your Group Policy administrator for
more information.
The Group Policy setting is Turn on Script Execution, found under Administrative Templates\Windows Components\Windows PowerShell. Its "Allow all scripts" option is equivalent to Unrestricted. On a work or school computer, a policy like this is deliberate, so ask the administrator instead of working around it.
Unrestricted is already the default on macOS and Linux
On non-Windows computers, the default execution policy is Unrestricted and cannot be changed. Set-ExecutionPolicy exists there but displays a console message that it is not supported. Microsoft adds that Get-ExecutionPolicy returns Unrestricted on those platforms, but the behavior really matches Bypass, because they do not implement Windows Security Zones.
Put it back
To remove a policy you set, set it to Undefined for the same scope:
Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser
For a machine-wide change, run the same command with -Scope LocalMachine from an administrator window. If every scope ends up Undefined, the effective policy is Restricted on Windows clients and RemoteSigned on Windows Server. If you want something in between, set RemoteSigned for CurrentUser as shown above.
Windows PowerShell and PowerShell 7 keep separate settings
Windows PowerShell 5.1 (powershell.exe) and PowerShell 6 and later (pwsh.exe) store the policy in different places and are managed separately. A change made in one does not affect the other. If scripts run in one window and still fail in another, repeat the command in the window that fails.
Frequently asked questions
- Is Set-ExecutionPolicy Unrestricted safe?
- It is not a malware filter either way, because Microsoft says the execution policy is not a security boundary. Unrestricted removes the one check that RemoteSigned keeps: blocking unsigned scripts that came from the internet. Unsigned downloaded scripts then run after a prompt, and Microsoft's own description of the policy says there is a risk of running malicious scripts.
- What is the difference between Unrestricted and Bypass?
- Unrestricted runs unsigned scripts but warns you before running scripts that are not from the local intranet zone. Bypass blocks nothing and shows no warnings or prompts. Microsoft designed Bypass for setups where PowerShell is embedded in a larger application that has its own security model.
- Why does Set-ExecutionPolicy Unrestricted ask me to confirm?
- The cmdlet asks you to confirm a change to the execution policy. Answer Y to apply it. The -Force parameter suppresses all confirmation prompts, and Microsoft advises caution with it.
- Do I need administrator rights for Set-ExecutionPolicy Unrestricted?
- Only for the LocalMachine scope, which is the default when you leave -Scope out. Microsoft says to start PowerShell with Run as Administrator to change LocalMachine. The CurrentUser and Process scopes do not need it.