Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Code signing error

$
0
0

Dear Sir,

 

              I used a script to sign scripts. 

 

               Following is the script I used. 

 

## sign-file.ps1

## Sign a file

param([string] $file=$(throw "Please specify a filename."))

$cert = @(Get-ChildItem cert:\CurrentUser\MY -codesigning)[0]

Set-AuthenticodeSignature $file $cert

 

                When I run this script, it will generate the following error:

 

Get-ChildItem : A parameter cannot be found that matches parameter name 'codesigning'.

At C:\Users\paul\Documents\Documents\WindowsPowerShell\scripts\sign-file.ps1:4 char:46

+ $cert = @(Get-ChildItem cert:\CurrentUser\MY -codesigning)[0]

+                                              ~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException

    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

 

Set-AuthenticodeSignature : Cannot bind argument to parameter 'Certificate' because it is null.

At C:\Users\paul\Documents\Documents\WindowsPowerShell\scripts\sign-file.ps1:5 char:33

+ Set-AuthenticodeSignature $file $cert

+                                 ~~~~~

    + CategoryInfo          : InvalidData: (:) [Set-AuthenticodeSignature], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.SetAuthenticodeSignatureCommand

 

                   When run the same script again, no more error.

                    Kindly help.

 

Paul Cheuk

 

 


Viewing all articles
Browse latest Browse all 8583

Latest Images

Trending Articles



Latest Images