Home » PowerShell » PowerShell script is not digitally signed

PowerShell script is not digitally signed

When we download PowerShell script from internet and try to run it on local system using PowerShell, it throws exception as PowerShell script is not digitally signed. Reason behind script not digitally signed is because of execution policy setup on your local system.

In Windows OS system, default Execution Policy as Restricted and it prevents script from running on your system that can potentially harm your computer. If PowerShell script downloaded from internet or other sources are not signed by trust publisher or having block, it will trigger error as PowerShell script is not digitally signed or 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 you how to fix PowerShell script is not digitally signed and can not run on this system.

PowerShell has built-in security features implemented. PowerShell Execution policy is a safety feature which controls the conditions to run scripts and load configuration. Execution Policy in PowerShell is setup to avoid running malicious scripts in your system.

Solution: PowerShell Script is not digitally signed

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

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

Using UnRestricted Execution Policy to fix script not digitally signed

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

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

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

Cool Tip: How to use multiline command in PowerShell!

Using ByPass Execution Policy to fix script digitally not signed error

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

With ByPass policy, scripts run temporary with lower security.

powershell -executionpolicy ByPass -File .\InstallUI.ps1
  • runs .ps1 script file with lower security for and execute it.
  • Once your close PowerShell session, it will also closed ByPass with it.

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

Unblock 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 file, using unblock-file we can unblock it to run in PowerShell session.

Use below command to unblock file downloaded from internet to fix script not digitally signed error.

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

Cool Tip: How to add newline to string or variable in PowerShell!

Conclusion

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

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

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

Leave a Comment