If PowerShell throws up an error message – File cannot be loaded because running scripts is disabled on this system, then you need to enable script running on your Windows 11/10 computer. The cause of this error comes from the fact that your user account does not have enough permissions to execute that script. This does not mean that you need to have Administrator level permissions; it also means that you also need to be unrestricted to run these types of PowerShell scripts or cmdlets
File cannot be loaded because running scripts is disabled on this system PowerShell error
There is only one way to carry out this task. You need to do is set the execution policy to be unrestricted.
For that, we will first check what policies are set for the individual user groups on your computer.
For that, Start by pressing WINKEY + X button combo or right-click on the Start button and click on Windows Powershell (Admin) or search for Powershell in the search box, right click on it and select Run as Administrator. Click on Yes for the UAC or User Account Control prompt that you get. Then, the Windows Powershell window will finally be open. Now, type in the following command to get the List of Execution Policy for all the scopes on your computer,
Get-ExecutionPolicy -List
This will put on a list on the User Groups and their Execution Policy status.
Under the column of Scope, you need to look out of LocalMachine.
If you find its Execution Policy set to either Undefined or Restricted, you have got your issue tracked down.
Now, the next thing that you need to do is set the Execution Policy to Unrestricted.
For that, you need to enter the following command in the same PowerShell session window,
Set-ExecutionPolicy Unrestricted
This will give you a message asking for various permissions for which either you will have to hit Y to say Yes to all the messages individually or hit the A key to say Yes to all the messages at once.
If that command throws an error, you can also force change the Execution Policy by entering the following command,
Set-ExecutionPolicy Unrestricted -Force
This will finally set the Execution Policy for your PowerShell Scripts and cmdlets to be Unrestricted.
Now, this should remove the error for you on PowerShell that says, File cannot be loaded because running scripts is disabled on this system.
Did that help you?
Read next: PowerShell Export-CSV access to the path is denied.