Configuring PowerShell to enable scripts

John Emmas 181 Reputation points
2026-07-12T10:23:47.39+00:00

Earlier today I tried to run a ".ps1" script in PowerShell but I got a message telling me that scripts weren't configured to run on my system. I followed some configuration instructions here and it all seemed to work:-

https://learn.microsoft.com/en-gb/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.6

However, next time I tried to run the script I got a new message telling me the script couldn't be run because it isn't digitally signed.

Interestingly, if I open a standard Windows terminal as Administrator, that seems to run the script without any problems (unless it just isn't reporting the problems). So is there a way I can fix this in PowerShell or do I need to refer it back to the script's originator?

Windows for home | Windows 10 | Accessibility
0 comments No comments

Answer accepted by question author
Marcin Policht 107.9K Reputation points MVP Volunteer Moderator
2026-07-12T11:04:12.97+00:00

This is the result of PowerShell's execution policy rather than a problem with the script itself. The first error indicated that your system was configured to prevent scripts from running at all. After changing the execution policy, PowerShell moved on to the next security check and discovered that the script is not digitally signed.

Whether an unsigned script is allowed depends on the execution policy that applies to the PowerShell session. For example, the Restricted policy blocks all scripts, RemoteSigned allows locally created scripts to run but requires downloaded scripts to be digitally signed, AllSigned requires every script to be signed regardless of where it came from, and Bypass imposes no signature checks. The exact policy in effect can also differ depending on whether it has been configured at the MachinePolicy, UserPolicy, Process, CurrentUser, or LocalMachine scope.

The fact that the script runs successfully from an elevated Windows Terminal suggests that the two PowerShell sessions are not actually using the same effective execution policy. Windows Terminal itself does not bypass PowerShell's security, but it may be launching a different version of PowerShell or one with a different execution policy in effect. For example, one session may be using Windows PowerShell 5.1 while the other is using PowerShell 7, or one may have a Process-level execution policy that overrides the system default.

If the script came from the Internet, another possibility is that Windows has marked it as having originated from an untrusted source. Even if the execution policy is set to RemoteSigned, PowerShell will refuse to run an unsigned script that still carries this "Mark of the Web." If you trust the source, you can remove that mark with the Unblock-File cmdlet or by opening the file's Properties dialog in File Explorer and selecting Unblock, if that option is present.

If your effective execution policy turns out to be AllSigned, then the error is expected because the script would need to be digitally signed with a trusted code-signing certificate. In that case, you would either need to change the execution policy to one that permits trusted local scripts, such as RemoteSigned, or ask the script's author to provide a properly signed version if your organization's security policy requires signed scripts.

If this is a personal computer rather than one managed by an organization, RemoteSigned is generally the recommended balance between usability and security. If the computer is managed by your employer, the execution policy may be enforced through Group Policy, in which case you should not attempt to circumvent it and should instead contact your IT administrator or the script's author for guidance.


If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

hth

Marcin

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. John Emmas 181 Reputation points
    2026-07-12T11:16:00.36+00:00

    Thanks guys. I didn't get around to trying Unrestricted but this seems to have fixed it:-

    Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

    Was this answer helpful?


  2. DaveM121 931.8K Reputation points Independent Advisor
    2026-07-12T10:59:09.3433333+00:00

    1

    Right click the .ps1 script file and select Properties.

    On the resulting properties dialog is there an 'Unblock' check-box you may nee to clear on that file.

    2

    If not, if you run this command first, are you able to execute that PowerShell script.Set-ExecutionPolicy Unrestricted

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.