Save 10%Pay yearly on any plan. 6% half-yearly, 3% quarterly. Help centreWhatsAppTelegram TeamsOpen a ticket

How to Enable PowerShell Scripts on Windows

PowerShell blocks script files by default. Change the execution policy for your user, for one script or for the whole computer, and know what it means.

2 min readBy Shailabh

Reviewed by the AmazingRDP technical team

Enabling PowerShell scripts on Windows

Automating a Windows server? A Windows VPS gives you full admin access. See Windows VPS from $8.99

You run a PowerShell script and get this:

File C:\scripts\job.ps1 cannot be loaded because running scripts is disabled on this system.

Nothing is broken. On Windows 10 and 11, PowerShell does not run script files until you allow it. The setting is called the execution policy, and one command changes it.

The fix for most people

Open PowerShell (no administrator rights needed) and run:

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

Answer Y. Your own scripts now run; scripts downloaded from the internet run only if they are signed or you have unblocked them.

See what is set

Get-ExecutionPolicy
Get-ExecutionPolicy -List

The second line shows every level at which a policy can be set. The first one in the list that is not Undefined wins.

The policies

PolicyMeans
RestrictedNo script files run. The default on Windows 10 and 11
RemoteSignedLocal scripts run; downloaded ones need a signature. The default on Windows Server
AllSignedEvery script needs a signature from a trusted publisher
UnrestrictedEverything runs; downloaded scripts ask first
BypassEverything runs, no questions. For automation that sets it per run

The scopes

ScopeApplies toNeeds administrator
ProcessThe current PowerShell window onlyNo
CurrentUserYour userNo
LocalMachineEvery user of the computerYes
Set-ExecutionPolicy -Scope Process Bypass
Set-ExecutionPolicy -Scope LocalMachine RemoteSigned

The first is the gentlest way to try a script: it ends when you close the window.

Run one script without changing anything

powershell -ExecutionPolicy Bypass -File C:\scripts\job.ps1

This is the form to use in Task Scheduler and in shortcuts. With PowerShell 7, the program is pwsh.

A downloaded script still refuses to run

Windows marks files that came from the internet. Under RemoteSigned such a file is blocked even though your own scripts run. After you have read the script and trust it:

Unblock-File C:\scripts\downloaded.ps1

The same is done by ticking Unblock in the file's Properties.

"The setting is overridden by a policy defined at a more specific scope"

On a company PC or a domain server the policy is set by Group Policy, shown as MachinePolicy or UserPolicy in the list. You cannot change it from PowerShell; the administrator sets it under Computer Configuration, Administrative Templates, Windows Components, Windows PowerShell, Turn on Script Execution.

What the execution policy is not

It is a safety catch against running a script by accident. It is not a security barrier: anyone can paste a script's contents into the window line by line. Do not choose Unrestricted or Bypass for the whole machine out of convenience, and read a script before you run it, above all one from a web page.

Back to the default

Set-ExecutionPolicy -Scope CurrentUser Undefined

Double-clicking a script opens it in Notepad instead of running it? That is a different setting: see making .ps1 files open with PowerShell. A first useful script: opening a port through PowerShell. The same error from npm or yarn is covered in 'node' is not recognized.

On our shared remote desktops you can set the policy for your own user. A Windows VPS gives you the whole machine.

Questions

How do I enable PowerShell scripts?

Run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned in PowerShell and confirm with Y.

What does "running scripts is disabled on this system" mean?

The execution policy is Restricted, the default on Windows 10 and 11, which blocks script files.

Is RemoteSigned safe?

It is the usual choice: your own scripts run, and downloaded ones need a signature or an explicit unblock.

How do I run a single script without changing the policy?

Use powershell -ExecutionPolicy Bypass -File script.ps1.