Fix: Execution of Scripts is Disabled on this system

Windows PowerShell is a command-line shell and scripting language designed especially for system administration. Its analogue in Linux is called as Bash Scripting. Built on the .NET Framework, Windows PowerShell helps IT professionals to control and automate the administration of the Windows operating system and applications that run on the Windows Server environment. Windows PowerShell commands, called cmdlets, let you manage the computers from the command line. Windows PowerShell providers let you access data stores, such as the Registry and Certificate Store, as easily as you access the file system. In addition, Windows PowerShell has a rich expression parser and a fully developed scripting language. So in simple words, you can complete all the tasks that you do with GUI and much more. Windows PowerShell Scripting is a fully developed scripting language and has a rich expression parser. Recently one user got an issue while running a script, He created a script in the windows ISE power shell then while trying to run he got an error like

Execution of Scripts is Disabled on this system-error

File C:\Common\Scripts\Basescript.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details. At line:1 char:13 + .\Basescript.ps1 <<<< + CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException

So this guide will help you to resolve the issue and what is the reason for this issue.

Steps:

  • Once you got the above-mentioned error open windows Power shell.
  • Type windows Power shell on windows search, Right-click on windows Power shell, and select Run as admin. This will open the windows power shell in admin mode.
opening the power shell in admin mode-Execution of Scripts is Disabled on this system

What is the reason for this error?

  • By default, there is a policy assigned which block power shell scripts to run. So while running the script you can see the above-mentioned error. To remove this error first you check the policy is restricted or not.
  • Open the power shell in admin mode and type the below-mentioned command.

get-executionpolicy

checking the mode in power shell-Execution of Scripts is Disabled on this system
  • This command will show the execution Policy is restricted or Not. As per the image the policy now restricted to enable this policy type below mentioned command.
enabling the execution policy-Execution of Scripts is Disabled on this system

Set-ExecutionPolicy unrestricted

Type [Y]–> yes

Type [A]–>yes To All

Type [N]–> NO

Type [L]–>No to All

Type [S]–>Suspend

Type A and hit enter. Now you can run any script you want.

after enabling-Execution of Scripts is Disabled on this system

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top