There are instance when you execute your PowerShell scripts on server from your command prompt you will end up seeing below mentioned error message.
Error Message
File cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details
This article mentions the steps which you need to follow to fix “File cannot be loaded because the execution of scripts is disabled on this system.” error message. Let’s learn how to set executionpolicy in PowerShell.
The primary reason why you end up seeing this error message is because of the PowerShell Execution Policy Security Settings which are built into the Windows PowerShell. It basically decides how PowerShell will execute the scripts.
The Windows PowerShell execution policy is by default set to be RESTRICTED and hence the scripts will not run until the settings are changed.
How to Verify the Existing PowerShell Execution Policy Setting
Step 1: Open Command Prompt and Enter PowerShell
Step 2: Type Get-ExecutionPolicy and hit enter as shown in the snippet below.
Get-ExecutionPolicy

There are basically Four Different Windows PowerShell Execution Policy behaviours namely:
- Restricted: – It is primarily an interactive mode, wherein no PowerShell scripts can be executed
- Unrestricted: – As the name suggests there is no restriction set and henceforth all the PowerShell scripts can be executed.
- RemoteSigned: – As the name suggests all the downloaded scripts needs to be signed from a trusted published to execute them on the server.
- AllSigned: – It means that the scripts which are signed from a trusted publisher can only be executed
Since in our case we have seen that Windows PowerShell Execution Policy is set to be Restricted on the server. We need to change the behaviour and for that we need to use the PowerShell cmdlet Set-ExecutionPolicy.
about_Execution_Policies
PowerShell’s execution policy is a safety feature that helps to control the conditions in which PowerShell loads configuration files and runs scripts. One of the primary advantages of PowerShell’s execution policy feature is that it helps prevent malicious scripts’ execution.
PowerShell execution policies
The PowerShell execution policies are AllSigned, ByPass, Default, RemoteSigned, Restricted, Undefined, and Unrestricted.
Execution policy scope
One can set an effective execution policy that is only valid for a particular scope. The available valid values for Scope are MachinePolicy, UserPolicy, Process, CurrentUser, and LocalMachine. When setting an execution policy, the default value is LocalMachine.
Privileges Needed to Execute Set-ExecutionPolicy PowerShell cmdlet | Privileges Needed to Set Executionpolicy PowerShell
One must be having Windows Administrator Privileges to execute Set-ExecutionPolicy PowerShell cmdlet on your windows operating system. If you are an administrator then you can open Command Prompt with Administrator Privileges (Run as Administrator) to execute Set-ExecutionPolicy PowerShell cmdlet. Either of the below options will work fine for you.
How to Change PowerShell Execution Policy Setting to Unrestricted | How to Set ExecutionPolicy Unrestricted
Step 1: Open Command Prompt and Enter PowerShell
Step 2: Type Set-ExecutionPolicy Unrestricted and hit enter as shown in the snippet below.
Set-ExecutionPolicy Unrestricted

How to Change PowerShell Execution Policy Setting to RemoteSigned | How to Set Executionpolicy RemoteSigned
Step 1: Open Command Prompt and Enter PowerShell
Step 2: Type Set-ExecutionPolicy RemoteSigned and hit enter as shown in the snippet below.
Set-ExecutionPolicy RemoteSigned

How to Get PowerShell cmdlet Syntax Help to understand information about PowerShell Syntax and Acceptable Parameters?
If you want to understand the syntax and the parameter acceptable for a PowerShell cmdlet then execute Get-Help followed by PowerShell cmdlet Set-ExecutionPolicy as shown in the snippet below to displays information about PowerShell concepts and commands, including cmdlets, functions, Common Information Model (CIM) commands, workflows, providers, aliases, and scripts.
Get-Help Set-ExecutionPolicy

Conclusion
In this article we have seen the steps which you need to follow to fix “File cannot be loaded because the execution of scripts is disabled on this system.” error message to run PowerShell scripts in your environment.