Signing Scripts
suggest changeRemarks
A signature lets a script run under AllSigned, and under RemoteSigned when the script is remote. PowerShell also refuses to run the script if the file changed after it was signed.
Signing requires a code-signing certificate. Recommendations:
- Personal scripts and testing (not shared): a certificate from a trusted certification authority (internal or third-party), or a self-signed certificate.
- Shared inside an organization: a certificate from a trusted certification authority (internal or third-party).
- Shared outside an organization: a certificate from a trusted third-party certification authority.
Read more in about_Signing.
Execution policies
Execution policy controls which scripts PowerShell will run. It can be set for the computer, the current user, and the current process. Group Policy scopes override those. Execution policy is easy to bypass. It is not a security boundary. It protects users from running unsigned scripts by accident.
| Setting | Description |
|---|---|
Restricted |
No scripts are allowed. This is the usual Windows client default. |
AllSigned |
Every script must be signed. |
RemoteSigned |
Local scripts may be unsigned. Remote scripts must be signed. This is the usual Windows Server default. |
Unrestricted |
All scripts may run. PowerShell still warns before a script downloaded from the internet. |
Bypass |
All scripts run, with no warning. |
Undefined |
Removes the policy for that scope. The scope then inherits a broader scope. If every scope is undefined, Windows clients behave as Restricted. |
Change the policy with Set-ExecutionPolicy, Group Policy, or powershell.exe -ExecutionPolicy.
Read more in about_Execution_Policies.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents