PowerShell is a powerful scripting tool that IT administrators and developers use for automation, configuration, and management tasks. However, security is a core principle in PowerShell, which often leads to the following error when running scripts:
File cannot be loaded because running scripts is disabled on this system.

This error typically occurs because PowerShell enforces execution policies to prevent unsigned or potentially harmful scripts from running. While this is an excellent security feature, it can sometimes become a roadblock, especially when you need to run a legitimate script that isn’t signed.
In this blog, we’ll dive into the root cause of this error and explore five practical ways to fix it, including temporary and permanent solutions. Whether you’re working in a development, testing, or production environment, these methods will help you choose the most secure and convenient approach for your use case.
What Is an Execution Policy?
Execution policies in PowerShell act as a safeguard by defining the conditions under which scripts can run. There are four common types of execution policies:
- Restricted: Default policy; doesn’t allow running any scripts.
- AllSigned: Requires all scripts to be signed by a trusted publisher.
- RemoteSigned: Requires signing only for scripts downloaded from the internet.
- Unrestricted: Allows all scripts to run, but warns for downloaded ones.
The error arises when your current execution policy prevents the script from running, often due to stricter settings like Restricted
or AllSigned
Why Is This Error Important?
PowerShell execution policies protect your system by ensuring that only verified scripts run. However, legitimate use cases like running internal scripts or downloaded tools can also trigger the error. Knowing how to handle this issue responsibly ensures that you maintain security without disrupting workflows.
Solutions to Fix the “PowerShell Script Not Digitally Signed” Error
1. Change the Execution Policy
One way to resolve the error is by changing the execution policy to Unrestricted
. This removes all restrictions, allowing any script to run.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Steps:
- Open PowerShell as an administrator.
- Run the above command.
- Confirm by typing
Y
when prompted.
⚠️ Warning: This approach can expose your system to malicious scripts. Use it only if you trust all scripts being executed.
2. Bypass Execution Policy for the Current Session
If you don’t want to change the policy permanently, you can bypass it for the current session.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Steps:
- Open PowerShell.
- Run the above command.
This setting applies only to the current session. Once you close the session, the policy reverts to its previous state, making this a safer choice for temporary script execution.
3. Unblock the Script File
Sometimes, PowerShell blocks scripts downloaded from the internet for security reasons. To unblock such a script, use the Unblock-File
cmdlet.
Unblock-File -Path "C:\path\to\your\script.ps1"
Steps:
- Replace
"C:\path\to\your\script.ps1"
with the actual path to your script. - Run the command.
This removes the “blocked” flag, allowing the script to execute without altering the execution policy.
4. Sign the Script
For a secure and long-term solution, sign your scripts with a digital certificate.
Steps:
- Obtain a code-signing certificate from a trusted Certificate Authority (CA).
- Use the
Set-AuthenticodeSignature
cmdlet to sign your script.
Set-AuthenticodeSignature -FilePath "C:\path\to\your\script.ps1" -Certificate $cert
Signed scripts are trusted and can run without altering the execution policy, ensuring both security and compliance.
5. Set Execution Policy to RemoteSigned
For a balanced approach, set the execution policy to RemoteSigned
. This allows locally created scripts to run without a signature while requiring signatures for downloaded scripts.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Steps:
- Open PowerShell as an administrator.
- Run the command.
- Confirm by typing
Y
when prompted.
This provides a middle ground between security and usability.
Additional Commands for Troubleshooting
Here are some handy commands to manage execution policies and scripts:
Check the current execution policy:
Get-ExecutionPolicy
Set the execution policy to Restricted:
Set-ExecutionPolicy -ExecutionPolicy Restricted
List all execution policies for all scopes:
Get-ExecutionPolicy -List
Best Practices
- Use
Unrestricted
only in development environments or as a last resort. - For production, prefer
RemoteSigned
orAllSigned
policies. - Always validate scripts from unknown sources.
- Consider signing critical scripts with a trusted certificate.