If you are using Windows PowerShell and it suddenly throws an error message saying, “File cannot be loaded because running scripts is disabled on this system”, then read on as this post will guide you on how you can fix this issue your Windows 10 computer. This kind of error in PowerShell is most likely due to the fact that your user account does not have the required permissions to execute the script. Although this does not mean that you need to have administrator-level permissions as it could also indicate that you have to be unrestricted to run these types of PowerShell scripts or cmdlets. Thus, to fix the error and carry out the task, you have to set the execution policy to be unrestricted. And to do that, you need to use the steps provided below as a reference.
Step 1: To get started, you have to check what policies are set for the individual user groups on your computer by tapping the Win + X key combination or by right-clicking on the Start button and clicking on Windows PowerShell (Admin). You can also search for PowerShell in the Start Search and then right-click on Windows PowerShell and select Run as administrator.
Step 2: If a User Account Control or UAC prompt appears, just click Yes to proceed. Once you’ve pulled up Windows PowerShell, type the following command to get the List of Execution Policy for all the scopes on your computer.
Get-ExecutionPolicy –List
Step 3: After you execute the command, it will give you a list of the User Groups as well as their Execution Policy status, and under the Scope column, look for “LocalMachine”. Once you find its Execution Policy you will notice that it’s either set to Undefined or Restricted.
Step 4: Now that you’ve determined the Execution Policy, you need to set it to Unrestricted if it is set to Restricted. To do that, you have to enter the following command in the very same PowerShell window.
Set-ExecutionPolicy Unrestricted
Step 5: After you execute the command, you will see a message that asks for various permissions for which you either have to tap Y to say Yes to each one of the messages individually or tap the A key to say Yes to all the messages to once. However, if the command throws another error, you can just force the Execution Policy to change by executing the following command.
Set-ExecutionPolicy Unrestricted -Force
Step 6: Once you’re done, it will finally set the Execution Policy for the Windows PowerShell scripts as well as cmdlets to be Unrestricted and fix the “File cannot be loaded because running scripts is disabled on this system” error.