Social Media Magazine

Windows Powershell Error Running Scripts Is Disabled

Posted on the 28 August 2020 by Pro Webguru @prowebguru

Recently I was trying a small project in free time in Node JS and while executing a script through Visual Studio Code, I got following error in Windows Powershell.

cannot be loaded because
running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/

~~~~~~~~ CategoryInfo : SecurityError: (:) [], PSSecurityException FullyQualifiedErrorId : UnauthorizedAccess
To fix scripts running permissions issue, find your Powershell app on Windows. Right click on it and open it in Administrator mode.

Once its opened, enter following command

Set-ExecutionPolicy RemoteSigned

Once it is entered, it will show you following prompt

C:\windows\system32\> Set-ExecutionPolicy RemoteSigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/ Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y

Type Y and hit enter. Again try running your script, and now it should work.

Once your work is done, you can set back policy to restricted using following command.

Set-ExecutionPolicy Restricted

Again, when prompted, press Y and hit enter.

Please let me know if this fixed your issue. Do share it with your friends and colleagues.

Back to Featured Articles on Logo Paperblog