FIX: Running Scripts is Disabled on this System in Windows 10 (Solved)

FIX: Running Scripts is Disabled on this System in Windows 10 (Solved)

 

PowerShell is an excellent and sophisticated cross-platform task automation solution. A PowerShell script is usually fairly simple to build and run on a Windows system. However, if you execute a script on your system, you may see the “Running scripts is disabled on this system.” error message. You will get the following error message if the system administrator has set a policy to prevent unauthorized scripts from running on the system. You must unblock the policy or modify the registry before running any scripts.

 

 

Table of Contents Correction 1 – Modify the PowerShell Fix 2 – Modify the Execution Policy 3 – Repair the Registry 1 – Modify the PowerShell
You can run code that circumvents the existing execution policy. You don’t have to change anything, but you can execute your script.

  1. Type “powershell” after pressing the Windows key and the S key simultaneously.

  2. Then, right-click on “Windows PowerShell” and select “Run as administrator.”

 

Powershell Run As Administrator

 

ADVERTISEMENT 3. When the Windows PowerShell screen displays, enter this code and modify it as needed, then press Enter to execute it.

powershell -ExecutionPolicy ByPass -ScriptName.ps1

[

Simply replace “nameofthescript.ps1” with the name of the script you want to run.

For example, if the script’s name is “myscript,” the command will be –

-ExecutionPolicy ByPass -File myscript.ps1]

 

Ps1 Min Myscript

 

You can run any script this way without changing the current script execution policy. This will not work if you are mass-executing scripts or developing an automated script.

You’ll have to wait for the next repair.

 

Fix 2: Modify the Execution Policy
If you prefer, you can change the existing execution policy settings.

  1. Press the Windows key once again and type “powershell.”

  2. Next, right-click on “Windows PowerShell” and select “Run as administrator” to launch the terminal with administrative privileges.

 

Powershell Run As Administrator

 

  1. When it does open, use this command to change the execution policy to your liking.

RemoteSigned Set-ExecutionPolicy

[

The script Execution Policy can be set to one of four modes. These are as follows:

Restricted – The default setting, which prevents PowerShell from running any scripts on the system.

Only scripts that have been signed and authorized are permitted to run in this mode.

RemoteSigned – In this mode, all of the scripts you’ve downloaded must have a trustworthy signature.

Unrestricted – You are free to run whatever script you choose. There are no restrictions on trusted signatures or trusted publishers.

For example, if you want to change the policy settings to ‘RemoteSigned,’ the command is –

RemoteSigned Set-ExecutionPolicy

]

Then, press “Y” and then enter.

 

Min. signed remotely

 

  1. If you see an error message, simply execute this command.

ADVERTISEMENT
-Scope CurrentUser -ExecutionPolicy RemoteSigned
Again, type “Y” and press Enter.

 

Currentuser Minimum Scope

 

After that, you can easily run the script as you see fit.

Run the script to see whether it works.

NOTE –

Script execution policies are typically restricted because misconfigured or poor scripts might be fatal to the system. So, once you’ve finished running the script, you may change the execution policy back to ‘Restricted.’

  1. Log in to PowerShell as an administrator.

  2. Now, simply run this one line of code to prevent any policy from running on the system.

Set-ExecutionPolicy Restricted 3. Type “Y” again and press Enter.

 

Policy on Restricted Execution Min

 

Finally, close the PowerShell window.

 

Fix 3 – Change the Registry
If you receive an error message while modifying the execution policy, you can use the Registry Editor to make changes.

  1. Simply type “regedit.msc” into the taskbar’s search box.

  2. Then, to access it, touch “Registry Editor.”

 

Min. Regedit Registry Editor

 

You are about to modify your registry. Because Registry Editor is such a vital aspect of your system, you should create a registry backup first.

When the Registry Editor appears, select “File.” Then select “Export” to make a new registry backup for your PC.

 

Windows 11 New Min. Registry Export

 

If something goes wrong later, you can use this backup.

  1. Now, expand the left-hand side as follows –

Computer\HKEY LOCAL MACHINE\SOFTWARE\Microsoft\PowerShell\ShellIds\ScriptedDiagnostics

  1. Then, double-tap the binary value “ExecutionPolicy.”

 

Dc Min Execution Policy

 

Simply type “Unrestricted” in the ‘Value Data:’ box.

  1. Finally, tap “OK” to preserve your changes.

 

Min. Unrestricted

 

Close the Registry Editor after that. Restart the system after you have closed the Registry Editor.

After restarting your computer, you may easily run any script you want.

Leave a Reply