Fix for PowerShell Script cannot be loaded because running scripts is disabled on this system error

Problem:
On trying to run a PowerShell script from the PowerShell console, received this error message: “File C:\temp\GenerateRpt.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.”

cannot be loaded because running scripts is disabled on this system

This is due to PowerShell’s policy to prevent untrusted scripts which can affect your Server environment.

Solution for “cannot be loaded because running scripts is disabled on this system:

  • Open PowerShell Console by selecting “Run as Administrator” and set the execution Policy with the command: Set-ExecutionPolicy RemoteSigned
  • Type “Y” when prompted to proceed 

This in fact sets the registry key: HKLM\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
Policy parameter takes below values:

  1. Restricted – No scripting allowed
  2. Unrestricted – You can any scripting
    • No signing required
  3. Remote signed – good for Test, Dev environments
    • Only files from internet need to be signed
    • This is the default setting
  4. All signed  – local, remote script, it should be signed.
    • user must agree to run script
Fix for PowerShell Script cannot be loaded because running scripts is disabled on this system error

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply