Would you like to learn how to encode Powershell scripts as Base64? In this tutorial, we will show you encrypt a Powershell script as Base64 and run the encoded version on Windows.

• 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 Windows - Encoding a Powershell script as Base64

Start a Powershell command-line.

Start Powershell

Create a Powershell script inside a variable.

Copy to Clipboard

Encode the Powershell script as Base64.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Run the encoded Powershell script.

Copy to Clipboard

There are multiple ways to run a Base64 encoded script.

Copy to Clipboard

Congratulations! You are able to encode a Powershell script as Base64.

Tutorial Powershell - Encoding a PS1 script as Base64

Start a Powershell command-line.

Start Powershell

Create a Powershell script

Copy to Clipboard

Edit the Powershell script.

Copy to Clipboard

Here is the script content.

Copy to Clipboard

Encode the Powershell script as Base64.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Run the encoded Powershell script.

Copy to Clipboard

There are multiple ways to run a Base64 encoded script.

Copy to Clipboard

Optionally, create a text file containing a Base64 script.

Copy to Clipboard

Run the encoded PS1 script file.

Copy to Clipboard

Congratulations! You are able to encode a PS1 script as Base64.