Loading...

Use PowerShell to convert your files (exe, ps1...) to Base64 and then back from Base64 to the file


In this post I will show you how to convert some files (EXE, PS1, TXT...) to a Base64 code then convert back the file from the Base64.


Context

- You want to download a file on device without to store it somewhere

- You have a script requiring some dependencies like DLL, EXE, PFX...


My use cases

I tested this solution as below:

- Convert ServiceUI.exe to Base64 for displaying toast for user in system context

- Convert a PFX certificate to base64 then import it just using the code


Our examples

We will see the below conversion examples:

- Convert an EXE to Base64 

- Convert a DLL to Base64

- Convert a TXT file to Base64

- Convert a CSV to Base64


I won't copy all the Base64 code here because it bugs my site :-)


How it works ?

We will proceed as below:

1. Convert the file to Base64

2. On the device we will convert the Base64 to the original file


Convert the file to Base64

See below our different Base64 conversions:


Convert Base64 to original file

See below our different Base64 conversions:

slider 578148967296107764

Publier un commentaire

Accueil item

Award

Endpoint Manager award

Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR

Stats