I can’t sign the script, the UnknownError error is popping up all the time. Changing the script file encoding does not help.

I sign the script with the following command:

 Set-AuthenticodeSignature "d:\dist1.ps1" @(Get-ChildItem cert:\CurrentUser\Krox -codesigning)[0] 

The error is returned in the following form:

 SignerCertificate Status Path ----------------- ------ ---- UnknownError dist1.ps1 
  • Please add to the question the commands with which you sign the script and the full text of the error - Cerbo

1 answer 1

Connect has a bug that describes a similar problem : it seems that Get-ChildItem does not give away a private key.

This is not the case for the private key. Hope this helps!

Try to export the certificate with a private key and do this:

 $Сert = Get-PfxCertificate .\myCertificate.pfx Set-AuthenticodeSignature -Filepath 'd:\dist1.ps1' -Cert $Cert -IncludeChain All 
  • Unfortunately, your advice did not help. When you try to sign the script, the same error crashes ... - krox