PowerShell is a tool built into Windows that helps you automate tasks and control different parts of your computer. However, when you try to run PowerShell scripts, you might see an error message saying, “Running scripts is disabled on this system.” This happens because, by default, PowerShell is set to block scripts for security reasons.
In this article, we will explain how PowerShell handles script permissions and show you how to fix this error so you can run scripts.
Understanding PowerShell Execution Policies
PowerShell uses different settings, called execution policies, to control if scripts can run. There are four main policies:
- Restricted: This is the default setting and it blocks all scripts from running. You can still use commands in PowerShell, but no scripts.
- AllSigned: You can run scripts, but only if they are signed by a trusted publisher. Scripts without a signature won’t work.
- RemoteSigned: You can run scripts created on your computer. If you download a script from the internet, it must be signed by a trusted publisher to run.
- Unrestricted: All scripts can run, no matter where they come from or if they are signed. This can be risky, so use this setting carefully.
Error:
The error happens when the current PowerShell policy doesn’t allow you to run scripts. I also got the same error when I tried to run a PowerShell script.
Solution:
To fix the “Running scripts is disabled on this system” error, you need to change the execution policy. Here’s how:
- Open PowerShell as an administrator: Click the Start menu, type “PowerShell”, right-click on “Windows PowerShell,” and choose “Run as administrator”.
- Check the current policy: To see what policy is set right now, type this command and press Enter:
Get-ExecutionPolicy
- Change the policy: To allow scripts to run, use the `Set-ExecutionPolicy` command. For example, to set the policy to RemoteSigned, type:
Set-ExecutionPolicy RemoteSigned
When asked to confirm, type “Y” and press Enter.
- Check the new policy: Run `Get-ExecutionPolicy` again to make sure the policy was changed.
- Close and reopen PowerShell to apply the changes.
Note: Changing the policy can affect your system’s security. Be careful which policy you choose, and try to use a setting like RemoteSigned for better security while still allowing scripts to run.
Conclusion
In this article, we talked about PowerShell’s execution policies and how to fix the “Running scripts is disabled on this system” error. By changing the policy, you can run scripts on your computer while keeping it safe. Make sure you only run scripts from trusted sources to avoid security risks. Once you fix the error, you can use PowerShell scripts to automate tasks and manage your system more easily.
18 Comments
Thanks a lot. It works for me..!
Thanks for the tutorial
I tried to write the command and the response was:
‘Set-ExecutionPolicy’ is not recognized as an internal or external command,
executable program or batch file.
Very good website my problem is solution
Thanks it worked
This fixed it for me on Windows 10 running in Parallels on a Macbook. Thanks for sharing this, a great help!
tnx dude it helps
Mine didn’t work. This is the error
Get-Process : A positional parameter cannot be found that accepts argument ‘Set-ExecutionPolicy’.
At line:1 char:1
+ PS C:\> Set-ExecutionPolicy RemoteSigned
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand
Run as admin; that should do it
same error with admin
You are using Get-Process ? May we see your full command?
All you should be entering is:
Set-ExecutionPolicy RemoteSigned
verry verrrrrrrrryyyyyyyyyyyyyyyyy helpful
thnaks
Thanks for your explanation about PS policy, It help me alot.
thanks it worked for me
how we can on window 10 plz tell me step by step
Hi,
please just notice that it need to be set separately for x86 and x64 versions of powershell.
Hi,RAHUL
Thank You So Much For PowerShell – Running scripts is disabled on this system. You Explanation is good.
will this script work on windows 7 ?
yes it will