24/7/365 Support

Verify the Digital Signature of a PowerShell Script

Problem

You want to verify the digital signature of a PowerShell script or formatting file.

Solution

To validate the signature of a script or formatting file, use the GetAuthenticodeSignature cmdlet:

PS >GetAuthenticodeSignature .\test.ps1

Directory: C:\temp

SignerCertificate Status Path

FD48FAA9281A657DBD089B5A008FAFE61D3B32FD Valid test.ps1

Discussion

The GetAuthenticodeSignature cmdlet gets the Authenticode signature from a file. This can be a PowerShell script or formatting file, but the cmdlet also supports DLLs and other Windows standard executable file types.

By default, PowerShell displays the signature in a format that summarizes the certificate and its status. For more information about the signature, use the FormatList cmdlet, as shown in Example 162.

Example 162. PowerShell displaying detailed information about an Authenticode signature

PS >GetAuthenticodeSignature .\test.ps1 | FormatList

SignerCertificate : [Subject] CN=PowerShell User

[Issuer] CN=PowerShell Local Certificate Root

[Serial Number] 454D75B8A18FBDB445D8FCEC4942085C

[Not Before] 4/22/2007 12:32:37 AM

[Not After] 12/31/2039 3:59:59 PM

[Thumbprint] FD48FAA9281A657DBD089B5A008FAFE61D3B32FD

TimeStamperCertificate : Status : Valid StatusMessage : Signature verified. Path : C:\temp\test.ps1

For more information about the GetAuthenticodeSignature cmdlet, type GetHelp GetAuthenticodeSignature.

Help Category:

Get Windows Dedicated Server

Only reading will not help you, you have to practice it! So get it now.

Processor RAM Storage Server Detail
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 128 GB (SSD SATA) Configure Server
Intel Atom C2750 2.4 GHz 8c/8t 8 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Xeon E3-1230 v2 3.3 GHz 4c/8t 16 GB DDR3 1× 256 GB (SSD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 250 GB (SSD SATA) Configure Server

What Our Clients Say