Skip to content

Not digitally signed error when running PowerShell script

You want to run a PowerShell script that you downloaded, but you are getting a not digitally signed error when running the PowerShell script and can’t proceed further. The script is downloaded locally on your system, and you are running it as administrator. Other scripts that you made are running just fine, but that downloaded script cannot be loaded. In this article, you will learn why you are getting this error in the first place and how to allow not digitally signed PowerShell script.

Not digitally signed error

Run PowerShell as administrator and run the PowerShell script that you have downloaded.

C:\Scripts\.\Script.ps1

The output shows the below error.

.\Script.ps1 : File C:\Scripts\Script.ps1 cannot be loaded. The file C:\Scripts\Script.ps1 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 http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\Script.ps1
+ ~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

How to fix the not digitally signed error?

First, start by browsing to the Windows PowerShell script file. When you have found the PowerShell script, right-click on the file and click on Properties.

Not digitally signed error when running PowerShell script properties

Stay on the General tab, and down below, you can see the Security option. It shows that this file came from another computer and might be blocked to help protect this computer. In other words, you can’t run the script for safety reasons. You have to trust it before you can make use of it.

Check the Unblock box and click OK.

Not digitally signed error when running PowerShell script security unblock

Now rerun the PowerShell script. It should work as expected without giving you an error. For example, the script cannot be loaded, and that the script is not digitally signed.

Fix not digitally signed error with PowerShell

If you want to unblock the file through PowerShell, make use of the Unblock-File cmdlet.

Unblock the script and start the script.

Unblock-File C:\Scripts\Script.ps1 ; C:\Scripts\.\Script.ps1

When there are many scripts in the folder and subfolders, you want to unblock all of them.

Get-ChildItem -Path "C:\Scripts\" -Recurse | Unblock-File

Keep reading: Exchange setup failed to install error code 1619 »

Conclusion

You learned how to fix the not digitally signed error when running PowerShell script. Unblock the file through File Explorer or PowerShell. It’s a minor fix but an important one. Which PowerShell script did you want to run and gave you this error? We need our PowerShell scripts to run correctly!

Did you enjoy this article? You may also like PowerShell remove quotation marks from a text file. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 0 Comments

Leave a Reply

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