The File Is Not Digitally Signed You Cannot Run This Script On The Current System in PowerShell

If you’ve ever tried to run a PowerShell script and encountered the error message “The file is not digitally signed. You cannot run this script on the current system”, you’re not alone. This is a common issue that many PowerShell users face, but fortunately, it’s relatively easy to fix.

The File Is Not Digitally Signed; Why Does This Error Occur?

The “not digitally signed” error occurs because of PowerShell’s execution policy settings. By default, PowerShell is configured to only allow signed scripts to run. This is a security measure to prevent unauthorized or malicious scripts from executing on your system.

When you try to run a script that isn’t digitally signed, PowerShell blocks it and displays the error message. This can be frustrating, especially if you know the script is safe and you wrote it yourself.

The File Is Not Digitally Signed You Cannot Run This Script: How to Fix?

There are two main ways to resolve this error:

  1. Sign your PowerShell scripts: You can digitally sign your scripts using a code signing certificate. This proves the script’s authenticity and allows it to run without changing the execution policy. However, obtaining a code signing certificate can be a bit involved.
  2. Change the PowerShell execution policy: The easier solution is to modify PowerShell’s execution policy to allow unsigned scripts to run. You can do this using the Set-ExecutionPolicy cmdlet. Changing the execution policy to “RemoteSigned” is usually a good choice as it allows locally created scripts to run while still requiring remote scripts to be signed.

To change the execution policy, open PowerShell as an administrator and run:

Set-ExecutionPolicy RemoteSigned

Confirm the change by typing “Y” when prompted.

After changing the execution policy, you should be able to run your unsigned local scripts without encountering the “not digitally signed” error.

A Word of Caution

While modifying the execution policy is a quick fix, it’s important to understand the security implications. Running unsigned scripts can be risky, as they could potentially contain malicious code. Always ensure you trust the source of a script before running it, even if you’ve set the execution policy to allow unsigned scripts.

If you’re in an enterprise environment, be aware that group policies may restrict your ability to change the execution policy. In such cases, you’ll need to work with your IT department to find a solution that aligns with your organization’s security policies.

Conclusion

In this tutorial, I have explained how to fix the error: the file is not digitally signed. you cannot run this script on the current system in PowerShell. By either signing your scripts or adjusting the execution policy, you can get your scripts running smoothly. Do let me know in the comment below if it fixed your issue.

You may also like:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.