How to fix powershell: cannot be loaded because running scripts is disabled on this system

How to fix powershell: cannot be loaded because running scripts is disabled on this system



Steps to Fix the Issue:

  1. Open PowerShell as Administrator:

    • Press Win + X, then select Windows PowerShell (Admin) or Windows Terminal (Admin) from the menu.

  2. Check the Current Execution Policy:

    • In the PowerShell window, run the following command to check the current policy:

      Get-ExecutionPolicy
  3. 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:

      Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
    • Explanation:

      • RemoteSigned allows 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 CurrentUser to apply the change only to your current user account, which is safer than changing the policy for all users.

  4. Confirm the Change:

    • When prompted to confirm the change, type Y (for Yes) and press Enter.

Comment