Powershell error: the file is not digitally signed. You cannot run this…

If you are trying to run a custom Powershell (.ps1) script, you might see the following error:

.\Powershell_script.ps1 : File
Powershell_script.ps1 cannot be loaded.
The file [Powershell_script] is not
digitally signed. You cannot run this script on the current system. For more information about running scripts and
setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

This problem is caused by the default Execution-Policy which prevents you from running custom Powershell scripts.

Solution: change execution policy

To fix this, open up a Powershell prompt as an Administrator:

Then in the Powershell prompt, enter the following command. If you get a question type “A (yes to all)”.

Set-ExecutionPolicy Unrestricted

You should see the following output:

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A

Now try to run the Powershell script again, it should now work!

Published
Categorized as Powershell

By Leendert de Borst

Freelance software architect with 10+ years of experience. Expert in translating complex technical problems into creative & simple solutions.

Leave a comment

Your email address will not be published. Required fields are marked *