Home » PowerShell » PowerShell script is not digitally signed

PowerShell script is not digitally signed

When we download the PowerShell script from the internet and try to run it on the local system using PowerShell, it throws an exception as the PowerShell script is not digitally signed.

The reason the PowerShell script is not digitally signed is because of the execution policy setup on your local system.

In the Windows OS system, the default Execution Policy is Restricted and it prevents scripts from running on your system that can potentially harm your computer.

If the PowerShell script downloaded from the internet or other sources is not signed by the trusted publisher, it will trigger an error as the PowerShell script is not digitally signed or the running script is disabled on this system error.

PowerShell Script is not digitally signed error
PowerShell Script is not digitally signed error

In this article, I will explain to you how to fix the PowerShell script is not digitally signed and can not run on this system, script file ps1 is not digitally signed error.

PowerShell has built-in security features implemented. The PowerShell Execution policy is a safety feature that controls the conditions to run scripts and load configuration.

Execution Policy in PowerShell is set up to avoid running malicious scripts in your system.

Solution: The PowerShell Script is not digitally signed

PowerShell Execution Policy in Restricted mode avoids running script to ensure safety.

Cool Tip: Use Get-ExecutionPolicy to know the default policy applied to your system.

Using UnRestricted Execution Policy to fix script not digitally signed

The easiest and unsecured way to fix the PowerShell script is not digitally signed error is to change the local computer execution policy to unrestricted.

Using PowerShell Set-ExecutionPolicy cmdlet, use unrestricted option to enable policy

Set-ExecutionPolicy -ExecutionPolicy unrestricted
  • Set up an UnRestricted execution policy
  • Press Y to confirm the Policy update change
  • Allows running local scripts and all scripts downloaded from the internet.
  • Now if you try to run the install.ps1 file PowerShell script file, it will prompt for permission before it runs.

Cool Tip: How to use the multiline command in PowerShell!

Using ByPass Execution Policy to fix ps1 is not digitally signed error

Using a temporary bypass execution policy, nothing is blocked and if you try to run a script, it won’t give you a warning or prompts for confirmation.

With the ByPass policy, scripts run temporarily with lower security and fix the script file PS1 is not digitally signed error.

powershell -executionpolicy ByPass -File .\InstallUI.ps1
  • runs .ps1 script file with lower security and executes it.
  • Once you close the PowerShell session, it will also close ByPass with it.

Cool Tip: How to convert decimal to hex in PowerShell!

Unblock the PowerShell Script File

Using PowerShell unblock-file cmdlet, unblock the files that are downloaded from the internet. By default, such files are blocked to protect the computer from potential harm.

If we trust these downloaded script files, using unblock-file we can unblock it to run in the PowerShell session.

Use the below command to unblock the file downloaded from the internet that fixes the PowerShell script file not digitally signed error.

PS D:> Unblock-File -Path \InstallUI.ps1

Cool Tip: How to add a new line to a string or variable in PowerShell!

Conclusion

I hope the above article to fix the PowerShell script is not digitally signed error using set-executionpolicy is helpful to solve your problem.

Using an Unrestricted execution policy or temporary ByPass execution policy can fix the PowerShell script not digitally signed error. If you trust the downloaded script file from the internet, using the unblock-file cmdlet, unblock it and run it.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.