You are trying to run a script on windows powershell and you get the error …ps1 cannot be loaded because running scripts is disabled on this system.
The Reason for the Problem
It is an execution policy problem: windows is trying to protect your system from running untrusted script. See message below:
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at…
Change windows execution policy. To do this, first of all make sure to open microsoft windows powershell as an administrator.
Even if you were working with powershell from within another application like vscode, i will ask that you exit powershell and close that application (except you are very sure that you are running powershell within that application as an administrator), so that you can have the opportunity to open windows powershell as an administrator.
Now copy and paste the following command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
to change execution policy that affects all users of the system, or if you would like the change in policy to affect only the current user, use the following code instead:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
To be sure that you have successfully changed the policy, copy and paste the following command:
If you find CurrentUser set to RemoteSigned (assuming you went with the second option above), then you have successfully changed the execution policy for the current user.
With that you can go back to what you were doing before encountering this problem to see if the limitation has been removed. In my particular case, i was trying to open a webserver from within a nodejs appication in vscode when i encounter the error message: http-server.ps1 cannot be loaded because running scripts is disabled on this system. But after changing the execution policy, i was able to start the webserver without any issue.
Hope this solves your problem too.