You want to upgrade Azure AD Connect to the latest version. Azure AD Connect will…
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.
Table of contents
Not digitally signed error
Run PowerShell as administrator. Change the directory to the c:\scripts folder. Then, run the PowerShell script that you have downloaded. You get 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.
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.
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
Keep reading: Exchange setup failed to install error code 1619 »
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.