Base64 Module #PowerShell

  • 0

Base64 Module #PowerShell

Tags :

Category : Windows PowerShell

Every now and then, I need powershell.exe’s EncodedCommand parameter in order to avoid trouble due to characters that interfere with command line processing. EncodedCommand accepts a base-64-encoded string and powershell.exe’s help shows how to get the base-64-representation of a given PowerShell command. But I always forget how to reverse engineer such a string and therefore decided to write two functions, ConvertTo-Base64String and ConvertFrom-Base64String.

I’ve bundled the functions in a PowerShell Module. Please find it in the PowerShell Gallery: Base64

The module adds two ScriptMethods to the System.String type, ToBase64String() and FromBase64String(), and the functions leverage this methods. Thus, you have the following possibilities to convert strings from/to base64: