Low Orbit Flux Logo 2 F

Enable Running PowerShell Scripts On This System

If you see an error similar to this when trying to run a PowerShell Script you might need to change the execution policy.


.\test1.ps1 : File C:\Users\user1\Desktop\test1.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\test1.ps1
+ ~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

From a PowerShell window, run this command to check if the policy is restricted or not.


Get-ExecutionPolicy

If you see the following it means that it is restricted and will need to be updated.


Restricted

You are probably going to need to run PowerShell with administrative permissions to change the execution policy.

From PowerShell, run this command to set the execution policy to “Unrestricted”.


Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Verify that it has been set:


Get-ExecutionPolicy

Try running a script:


.\hello.ps1