34,333
edits
Changes
→Signing a Windows PowerShell Script
</pre>
Attempting to execute the script now causes PowerShell to display a warning that the script was signed by an untrusted publisher, but provides the option to run the script anyway (Run once), or to run the script and also trust all future scripts signed with this certificate (Always run): <pre>PS C:\Users\Administrator> ./t.ps1 Do you want to run software from this untrusted publisher?File C:\Users\Administrator\t.ps1 is published by CN=PowerShell Cert and is not trusted on yoursystem. Only run scripts from trusted publishers.[V] Never run [D] Do not run [R] Run once [A] Always run [?] Help (default is "D"):</pre>
Previously in this chapter, it was noted that signing also prevents tampering with the contents of a script. When the contents of a signed script are modified, an attempt to execute the script will result in the following error: