How to Set PowerShell Execution Policy in Windows 10
PowerShell execution policy is a security measure that determines whether scripts have permission to run on the Windows system. By default, the execution policy is set to "Restricted" in Windows 10/Server.
That means, you cannot execute scripts, but you can still execute individual commands in the PowerShell Window. If you create a script, and then try to run it, you will get an error message, similar to the following:
cannot be loaded because running scripts is disabled on this system.
To check the current PowerShell execution policy setting, you can use the following command:
We can change the execution policy setting using the
In the preceding example, we change the execution policy to Bypass, which allows the script to run without any restriction.
The following are possible values for the execution policy in Windows PowerShell.
- Restricted - You will not be allowed to execute a PowerShell script.
- AllSigned - Must be signed by a trusted publisher.
- RemoteSigned - You can run scripts that you have written on the local computer.
- Unrestricted - Unsigned scripts can run, you will get a security warning.
- Bypass - Nothing is blocked and no warnings are given when you run scripts.