skip to Main 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. Change the directory to the c:\scripts folder. Run the PowerShell script that you have downloaded. You are getting an error.

PS C:\> cd C:\scripts

PS C:\scripts>.\script.ps1
.\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’s showing 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. In this example, we are changing the path to the scripts folder. After that, we unblock the script and start the script.

PS C:\>cd C:\scripts\

PS C:\scripts>Unblock-File script.ps1 ; .\script.ps1

Have a look at Microsoft TechNet for some great PowerShell scripts.

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

Thoughts

In this article, 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 small 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 Antivirus exclusions for Exchange 2013 and 2016. 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 *