[powershell] Why is my locally-created script not allowed to run under the RemoteSigned execution policy?

Since this question continues to attract responses that are either refuted by the question body or don't address the actual problem, please read this simple summary of what you need to know:

  • This is not a "Why won't my default installation of PowerShell run scripts?" question.
  • This is not a "Why won't my installation of PowerShell run scripts downloaded from the internet?" question.
  • The question is why the RemoteSigned execution policy is preventing script execution when it shouldn't.
  • RemoteSigned is the only execution policy I want to use. I am aware that other, less-restrictive policies are available. If those policies were acceptable substitutes I would have just used them instead and this question wouldn't exist.
  • The execution policy is already set to RemoteSigned. Changing it from RemoteSigned to RemoteSigned is not a solution.
  • The script file is created and stored locally.
  • The script file is not blocked. The script file was never blocked (see previous point).
  • The script file cannot be unblocked because there is nothing to unblock (see previous point).
  • The script file is (attempted to be) executed by an administrator.
  • Windows PowerShell is the only application involved. Not Windows PowerShell ISE nor Command Prompt nor any other tools or editors are relevant.
  • The cause of the problem has already been identified (see accepted answer). After nearly 8 years, I think all other obvious explanations, whether applicable or not, have been posted, too. If you think otherwise then please read the question and existing answers in their entirety before adding yours.

I am using Windows PowerShell 2.0 on 64-bit Windows 7 Professional. I have a script on my Desktop that causes the following error when I try to run it:

File C:\Users\UserName\Desktop\Script.ps1 cannot be loaded. The file C:\Users\UserName\Desktop\Script.ps1 is not digitally signed. The script will not execute on the system.  Please see "get-help about_signing" for more details..
At line:1 char:54
+ C:\Users\UserName\Desktop\TestGetWindowsUpdateLog.ps1 <<<<
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

I am both a domain administrator and a local administrator, and if I run Get-ExecutionPolicy -List, I can see that the Group Policy Object I created to configure PowerShell is correctly applying the RemoteSigned execution policy at the machine level:

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy    RemoteSigned
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine       Undefined

I created the script myself in Notepad, and used the Sysinternals' streams utility and the file Properties dialog to confirm that the script is not being treated as having come from the internet. If I copy the script to a network share on a domain server, then it's allowed to execute. If I run Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine then the local script is still not allowed to execute, which makes sense since the execution policy at the MachinePolicy scope will take precedence.

As documented by about_Execution_Policies(current; at time of question), the RemoteSigned policy means:

  • Scripts can run.

  • Requires a digital signature from a trusted publisher on scripts and configuration files that are downloaded from the Internet (including e-mail and instant messaging programs).

  • Does not require digital signatures on scripts that you have run and that you have written on the local computer (not downloaded from the Internet).

  • Risks running unsigned scripts from sources other than the Internet and signed, but malicious, scripts.

My script is not signed, but since it is both created and executed locally, it should satisfy the third bullet point above. Therefore...

  • Why is my script not being allowed to run?
  • Why does PowerShell complain that my script "is not digitally signed" when that requirement should only apply to files from the Internet?
  • Why does PowerShell no longer care about the script not being signed when it's run from a network share?

The answer is


What works for me was right-click on the .ps1 file and then properties. Click the "UNBLOCK" button. Works great fir me after spending hours trying to change the policies.


Select your terminal Command prompt instead of Power shell. That should work.


If the file is copied from a network location, that is, another computer, Windows might have blocked that file. Right click on the file and click on the unblock button and see if it works.


Try running the Powershell GUI as Administrator


I was having the same issue and fixed it by changing the default program to open .ps1 files to PowerShell. It was set to Notepad.


Is the file being blocked? I had the same issue and was able to resolve it by right clicking the .PS1 file, Properties and choosing Unblock.


Run below 2 commands in PowerShell window

  1. Set-ExecutionPolicy unrestricted

  2. Unblock-File -Path D:\PowerShell\Script.ps1


this code line was working in Ubuntu with virtualbox and with Win 10 as a virtual os , inside of the powershell

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

If it is not working I recomand to read this resources below :

Set-ExecutionPolicy

Module: Microsoft.PowerShell.Security Sets the PowerShell execution policies for Windows computers.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.1#:~:text=To%20change%20the%20execution%20policy,Get%2DExecutionPolicy%20with%20no%20parameters.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-executionpolicy?view=powershell-7.1

Get-ExecutionPolicy -List

https://devblogs.microsoft.com/scripting/hey-scripting-guy-how-can-i-sign-windows-powershell-scripts-with-an-enterprise-windows-pki-part-2-of-2/


When you run a .ps1 PowerShell script you might get the message saying “.ps1 is not digitally signed. The script will not execute on the system.” To fix it you have to run the command below to run Set-ExecutionPolicy and change the Execution Policy setting.

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

I have found out when running a PS1 file for a Mapped drive to Dropbox that I'm always getting this error. When opening up properties for the PS1 there is no "Unblock".

The only thing that work for me is

powershell.exe -executionpolicy bypass -file .\Script.ps1


Some things to check:

Can you change to unrestricted?

Set-ExecutionPolicy Unrestricted

Is the group policy set?

  • Computer Configuration\Administrative Templates\Windows Components\Windows PowerShell
  • User Configuration\Administrative Templates\Windows Components\Windows PowerShell

Also, how are you calling Script.ps1?

Does this allow it to run?

powershell.exe -executionpolicy bypass -file .\Script.ps1

This is an IDE issue. Change the setting in the PowerShell GUI. Go to the Tools tab and select Options, and then Debugging options. Then check the box Turn off requirement for scripts to be signed. Done.


Please make a backup for the script.bs1 file

What works for me was deleting the script.bs1 file and running the execution command.


Examples related to powershell

Why powershell does not run Angular commands? How do I install the Nuget provider for PowerShell on a unconnected machine so I can install a nuget package from the PS command line? How to print environment variables to the console in PowerShell? Check if a string is not NULL or EMPTY The term 'ng' is not recognized as the name of a cmdlet VSCode Change Default Terminal 'Connect-MsolService' is not recognized as the name of a cmdlet Powershell Invoke-WebRequest Fails with SSL/TLS Secure Channel Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet Change directory in PowerShell

Examples related to powershell-2.0

Extract the filename from a path Out-File -append in Powershell does not produce a new line and breaks string into characters Using PowerShell to remove lines from a text file if it contains a string PowerShell The term is not recognized as cmdlet function script file or operable program Can't install nuget package because of "Failed to initialize the PowerShell host" Powershell script to see currently logged in users (domain and machine) + status (active, idle, away) How to export data to CSV in PowerShell? powershell is missing the terminator: " PowerShell script to check the status of a URL How to upgrade PowerShell version from 2.0 to 3.0

Examples related to code-signing

Xcode error: Code signing is required for product type 'Application' in SDK 'iOS 10.0' Code signing is required for product type 'Application' in SDK 'iOS 10.0' - StickerPackExtension requires a development team error Xcode 7 error: "Missing iOS Distribution signing identity for ..." The executable gets signed with invalid entitlements in Xcode iOS 7.0 No code signing identities found “Unable to find manifest signing certificate in the certificate store” - even when add new key Code signing is required for product type 'Application' in SDK 'iOS5.1' Why is my locally-created script not allowed to run under the RemoteSigned execution policy? The entitlements specified...profile. (0xE8008016). Error iOS 4.2 Xcode 'CodeSign error: code signing is required'

Examples related to executionpolicy

Why is my locally-created script not allowed to run under the RemoteSigned execution policy?