Running a .ps1 PowerShell script will sometimes result in the following message:
“<script>.ps1 is not digitally signed. The script will not execute on the system.”
The fix is to run Set-ExecutionPolicy and change the Execution Policy setting.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
This command sets the execution policy to bypass for only the current PowerShell session After the window is closed, the next PowerShell session will open running with the default execution policy. “Bypass” means nothing is blocked and no warnings, prompts, or messages will be displayed.
Possible values for the -ExecutionPolicy parameter:
— Restricted: The default setting which does not load configuration files or run scripts.
— AllSigned: Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.
— RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted remote publisher.
— 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.
— Bypass: Nothing is blocked and there are no warnings or prompts.
— Undefined: Removes the currently assigned execution policy from the current scope, returning the session to the default. This parameter will not remove an execution policy that is set in a Active Directory Group Policy.