powershell default execution policy code example

Example 1: set execution policy powershell

Set-ExecutionPolicy RemoteSigned  # to set the policy to RemoteSigned.
 Set-ExecutionPolicy Unrestricted  # to set the policy to Unrestricted.
 Get-ExecutionPolicy # to verify the current settings for the execution policy.

Example 2: how to change execution policy powershell

Set-ExecutionPolicy -ExecutionPolicy <PolicyName> # general syntax
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned # for example