• Creator
  • #3958121

    Powershell -CodeSigningCert not working

    by JB_Beta ·

    A few months back we instituted a policy of only allowing signed PS scripts. I generated a CodeSigningCert request and a cert was created by our internal CA. I created the .cer from the code then imported it. I signed dozens of scripts for use across the org. It has been working well. I had to wipe my machine and cannot get it to work now. See relevant info below. Certmgr sees it as a codesigningcert but not powershell. Any ideas? This is driving me crazy.
    PS C:\> Set-AuthenticodeSignature -FilePath C:\Development\Hello_World.ps1 -Certificate $c
    Set-AuthenticodeSignature : Cannot sign code. The specified certificate is not suitable for code signing.
    At line:1 char:1
    + Set-AuthenticodeSignature -FilePath C:\Development\Hello_World.ps1 -C …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Set-AuthenticodeSignature], PSArgumentException
    + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.SetAuthenticodeSignatureCommand

    PS C:\> $c | Format-list *

    PSPath : Microsoft.PowerShell.Security\Certificate::currentuser\my\CA15BEF8A15C6CE31BB8FA5E1201172F05
    PSParentPath : Microsoft.PowerShell.Security\Certificate::currentuser\my
    PSChildName : CA15BEF8A15C6CE31BB8FA5E1201172F05DD21DD
    PSDrive : Cert
    PSProvider : Microsoft.PowerShell.Security\Certificate
    PSIsContainer : False
    EnhancedKeyUsageList : {Code Signing (}

    • This topic was modified 2 years, 3 months ago by JB_Beta.

You are posting a reply to: Powershell -CodeSigningCert not working

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

Viewing 0 reply threads