How to fix powershell: cannot be loaded because running scripts is disabled on this system
Steps to Fix the Issue:
-
Open PowerShell as Administrator:
-
Press
Win + X, then select Windows PowerShell (Admin) or Windows Terminal (Admin) from the menu.
-
-
Check the Current Execution Policy:
-
In the PowerShell window, run the following command to check the current policy:
-
-
Set the Execution Policy to RemoteSigned:
-
To allow scripts that are downloaded from the internet to be run (but only if they are signed by a trusted publisher), run the following command:
-
Explanation:
-
RemoteSignedallows the running of local scripts without a signature, but requires scripts that are downloaded from the internet to be signed by a trusted publisher. -
You can also set the scope to
CurrentUserto apply the change only to your current user account, which is safer than changing the policy for all users.
-
-
-
Confirm the Change:
-
When prompted to confirm the change, type
Y(for Yes) and press Enter.
-