If you have tried to run a PowerShell script that isn’t signed, you’ve likely stumbled upon the following error <PowerShell Script file> is not digitally signed. You cannot run this script on the current system.
Windows PowerShell is a shell initially developed by Microsoft for the purposes of task automation and configuration management. There’s no wonder that its Execution Policy is set to Restricted, which protects from running malicious scripts.
However, this security error can occur when the PowerShell Execution Policy is set to AllSigned or RemoteSigned and the script isn’t signed. If you’d like to sign the script and solve this, here are a few methods that may help.
What can I do if PowerShell is not digitally signed?
1. Check and change Execution Policy
Let’s take a look at how to check the Execution Policy, as well as how this can be used to get rid of your error. First of all, you may run Get-ExecutionPolicy cmdlet to get your Execution Policy. The list parameter in the Get-ExecutionPolicy cmdlet tells you the policy for each scope.
At this point, a convenient method is to change the Execution Policy using the SetExecutionPolicy cmdlet. The following command sets the execution policy to Unrestricted: PS C:> Set-ExecutionPolicy unrestricted. Press Y to confirm the change when prompted.
The policy change is updated in the registry and remains this way, at least until you change it again. Note that Unrestricted means loading absolutely all configuration files and running all scripts. If you run an unsigned script that was downloaded from the Internet, you are though prompted for permission before it runs.
2. Bypass the current PowerShell session
Another quick fix is to run Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass. This simple command above will set the execution policy to bypass the current PowerShell session.
Even better, once you close this PowerShell session, these settings will be lost.
3. Unblock the file that was downloaded
When the Execution Policy is RemoteSigned, this requires that all scripts and configuration files downloaded from the Internet or from emails are signed by a trusted publisher.
If you trust the contents of the script are safe, then you can unblock it to run on your session using the Unblock-File cmdlet: PS C:> Unblock-File -Path C:Downloadsscript1.ps1.
If you have any questions about these fixes for the encountered PowerShell error, leave us a message in the comments section below. We’ll do our best to assist you.