Powershell set execution policy

ExecutionPolicy

Specifies the execution policy. If there are no Group Policies and each scope’s execution policy is set to Undefine, then Restricted becomes the effective policy for all users.

Acceptable execution policy values are as follows:

  • AllSigned. Requires that all scripts and configuration files are signed by a trusted publisher, including scripts written on the local computer.
  • Bypass. Nothing is blocked and there are no warnings or prompts.
  • Default. Sets the default execution policy. Restricted for Windows clients or RemoteSigned for Windows servers.
  • RemoteSigned. Requires that all scripts and configuration files downloaded from the Internet are signed by a trusted publisher. The default execution policy for Windows server computers.
  • Restricted. It doesn’t load configuration files or run scripts. The default execution policy Windows client computers.
  • Undefined. No execution policy is set for the scope. Removes an assigned execution policy from a scope that is not set by a Group Policy. If the execution policy in all scopes is Undefined, the effective execution policy is Restricted.
  • Unrestricted. Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs. The default execution policy for non-Windows computers and cannot be changed.


example:

#Dont forget to run powershell as Administrator
Set-ExecutionPolicy Unrestricted