Allow scripts stored on your machine to run unsigned
suggest changeFor security reasons, Windows PowerShell on client operating systems defaults to the Restricted execution policy, which blocks scripts. (Windows Server often defaults to RemoteSigned.) The following command allows local unsigned scripts. Run PowerShell as Administrator to change the policy for the local machine:
Set-ExecutionPolicy RemoteSigned
Another way to run PowerShell scripts is to use Bypass as ExecutionPolicy:
powershell.exe -ExecutionPolicy Bypass -File "c:\MyScript.ps1"
Or from within your existing PowerShell console or ISE session by running:
Set-ExecutionPolicy Bypass Process
A temporary workaround is to start the PowerShell executable and pass any valid policy as the -ExecutionPolicy parameter. The policy lasts only for that process, so no administrative access to the registry is needed.
C:\>powershell -ExecutionPolicy RemoteSigned
There are multiple other policies available, and sites online often encourage you to use Set-ExecutionPolicy Unrestricted. This policy stays in place until changed, and lowers the system security stance. This is not advisable. RemoteSigned is recommended because it allows locally stored and written code, and requires remotely acquired code to be signed with a certificate from a trusted root.
Also, beware that the Execution Policy may be enforced by Group Policy, so that even if the policy is changed to Unrestricted system-wide, Group Policy may revert that setting at its next enforcement interval (typically 15 minutes). You can see the execution policy set at the various scopes using Get-ExecutionPolicy -List
TechNet Documentation: