joosts
joosts

Reputation: 164

Problems with PowerShell execution policies

I'm trying to execute a PowerShell script called load_ssh_keys.ps1 to load my ssh keys into the Pageant agent.

My script works correctly when I call it directly from the PowerShell prompt, but as soon as I try to call the script from Windows Explorer it silently fails. Also if I call it from a Python script, I get an error message pointing me to the Execution Policy help page of Microsoft.

I signed my powershell script with a self-signed certificate and my execution policy is set to RemoteSigned.

$ Get-ExecutionPolicy -list
        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine    RemoteSigned
$ Get-ChildItem Cert:\LocalMachine\My -CodeSigningCert

   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My

Thumbprint                                Subject              EnhancedKeyUsageList
----------                                -------              --------------------
36DCDEE464F1A96C0B40ECA4****************  CN=JoostS            Sig for code signing
Get-AuthenticodeSignature D:\scripts\load_ssh_keys\load_ssh_keys.ps1

    Directory: D:\scripts\load_ssh_keys

SignerCertificate                         Status                    StatusMessage             Path
-----------------                         ------                    -------------             ----
36DCDEE464F1A96C0B40ECA4****************  Valid                     Signature verified.       load_ssh_keys.ps1

Would you have any idea why my script execution could be denied?

Thanks, Joost

Upvotes: 0

Views: 40

Answers (0)

Related Questions