In this comprehensive tutorial, you will learn how to digitally sign a Powershell script. This step-by-step guide will provide you with all the necessary information to successfully Sign a Powershell script.

• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 2022
• Windows 10
• Windows 11

Equipment list

Here you can find the list of equipment used to create this tutorial.

This link will also show the software list used to create this tutorial.

Related tutorial - PowerShell

On this page, we offer quick access to a list of tutorials related to PowerShell.

Tutorial - Digitally sign Powershell scripts

Start a Powershell command-line.

Start Powershell

Create a self-signed certificate using Powershell

Copy to Clipboard

List the certificates in the current user's personal store.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Export the public key of the certificate.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Start an elevated Powershell command line.

Windows 10 - powershell elevated

Import this certificate as a trusted root certification authority.

Copy to Clipboard

Import this certificate as a trusted publisher.

Copy to Clipboard

Access the certificate file and verify if the system trusts it.

POWERSHELL - DIGITALLY SIGN SCRIPTS

Create a Powershell script.

Copy to Clipboard

Here is our Script content.

Copy to Clipboard

Digitally sign the Powershell script.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Access the Powershell Script properties and verify if the system trusts it.

DIGITALLY SIGN POWERSHELL SCRIPTS

There are multiple ways to digitally sign the Powershell script.

Copy to Clipboard

Congratulations! You are able to create digitally signed Powershell Scripts.

Tutorial Powershell - Testing digitally signed Scripts

Change the Powershell execution policy to allow only signed scripts.

Copy to Clipboard

Execute our digitally signed Powershell script.

Copy to Clipboard

Execute a Powershell script not digitally signed.

Copy to Clipboard

Congratulations! You are able to run digitally signed Powershell Scripts.