Powershell Command : Set-AuthenticodeSignature

Set-AuthenticodeSignature :

This cmdlet was used to set the Authenticode signature in a file.

Set-AuthenticodeSignature Description :

The Set-AuthenticodeSignature cmdlet was used to set the authenticode signature of the associated file, if that file supports Subject Interface Package (SIP).

Set-AuthenticodeSignature Syntax :

Parameter Set: ByPath
Set-AuthenticodeSignature [-FilePath] <String[]> [-Certificate] <X509Certificate2> [-Force] [-HashAlgorithm <String> ] [-IncludeChain <String> ] [-TimestampServer <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByLiteralPath
Set-AuthenticodeSignature [-Certificate] <X509Certificate2> -LiteralPath <String[]> [-Force] [-HashAlgorithm <String> ] [-IncludeChain <String> ] [-TimestampServer <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Set-AuthenticodeSignature Parameters :

-FilePath<String[]>

It was used to specify the path of the file which we are going to sign.

-Certificate<X509Certificate2>

This parameter was used to specify the certificate which will be used to sign the script or the file.

-Force

It was used for appending the signature to the read-only file.

-HashAlgorithm<String>

It specifies the hash algorithm.

-IncludeChain<String>

Used for determining the certificates in the certificate chain.

-TimestampServer<String>

it adds time stamp to the signature.

-LiteralPath<String[]>

It was also used to specify the path of the file but the value of literal path parameter is used exactly as it was typed and wildcard characters are not used here.

-Confirm

It will prompt you for a confirmation before running a cmdlet.

-WhatIf

It will show what happens when the cmdlet runs.

CommonParameters:

-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable.

Get-AuthenticodeSignature Examples :

1) This command is retrieves a code-signing certificate from the certificate provider and used for signing tthe powershell script.

PS C:> $cert=Get-ChildItem -Path cert:CurrentUsermy -CodeSigningCert
PS C:>Set-AuthenticodeSignature -FilePath PsTestInternet2.ps1 -certificate $cert

2) This command uses the Get-PfxCertificate cmdlet to find a code signing certificate.

PS C:> $cert = Get-PfxCertificate C:TestMysign.pfx
PS C:>Set-AuthenticodeSignature -Filepath ServerProps.ps1 -Cert $cert

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *