Sign PowerShell Script with a Code Signing Certificate

Easy steps to sign PowerShell Script with a Code Signing Certificate

Windows PowerShell is a scripting language and an object-oriented automation engine specially designed for the system administrators. It also helps IT professionals to automate and control the administration of the Window OS as well as other applications.

The initial version of PowerShell 1.0 was released in the year 2006. Now, PowerShell is at version 5.1. With the passing years and increasing versions, the capabilities and hosting environments of PowerShell have developed drastically.

It has introduced some amazing new concepts that allow you to expand the knowledge you have gained and the scripts that you have created within the Windows Command Prompt as well as Windows Script Host environments.

Powershell Script brings the combination of command-line speed, the flexibility of scripting, and the power of a GUI-based admin tool. It enables you to resolve problems resourcefully by facilitating system admin to get rid of future manual labor hours.

Some of the Powershell uses: 

  • Powershell provides a well-integrated command-line experience for the operation system
  • It is aimed for system administrators to create a more simple syntax
  • PowerShell enables total access to all of the types in the .NET framework
  • It is highly trusted by system administrators
  • PowerShell is a simple way to maneuver server and workstation components

Choose Code Signing Certificate to Sign PowerShell Script 

It can be helpful if you digitally sign the script, when creating PowerShell scripts for distribution. Aside from that, it ensures that the person obtaining your code knows it has not altered since you sent it, and can confirm you as the person signing the code. If you put a code on GitHub, you must have a code signing certificate.

If you talk about certificates, you have got two prime alternatives. You can make use of your own CA (certificate authority) to issue the certificate(s) or you can use a public CA. The advantage of the public CA is that their root CAs is actually fully trusted making it more constructive. If you issue your own certificates, you can experience problems with other people trusting your code signing certificates.

 How to Sign PowerShell Script with a Code Signing

 Step #1 – Enroll by purchasing a Microsoft Authenticate Code Signing ID from Symantecyou’re your OS platform or target browser.

 Step # 2 – Download the signing tool and validate your account. Install the latest Windows PowerShell SDK. 

 Start>>>>All programs>>>>Accessories>>>>Windows PowerShell

 Step # 3 – To confirm, if the code signing certificate was generated properly; make use of specific command and obtain the certificate. By using that specific command the Windows PowerShell Certificate provider can view the information in the certificate.

get-childitem cert:\CurrentUser\my -codesigning

The above-mentioned command uses the Windows PowerShell Certificate provider to analyze information about the certificate

Once you have signed, you can substantiate the signature by using right-click on the .ps1 file, then go to the properties and click on the Digital Signature.

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

Set-AuthenticodeSignature <your_file>.ps1 $cert


The final say  

Now that you are aware of Windows PowerShell, benefits it offers, reasons to choose Code Signing Certificate to Sign PowerShell Script, and simple steps to sign PowerShell Script with a Code Signing, you can anytime perform this process. If you have any doubts regarding Windows PowerShell you can always get in touch with us.

Buy Code Signing Certificate at $59 Per Year

Leave a Reply

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