ConvertFrom-Base64

Converts a base-64 encoded string back into its original string.

Syntax

ConvertFrom-Base64 [-Value] <String[]> [[-Encoding] <Encoding>] [<CommonParameters>]

Description

For some reason. .NET makes encoding a string a two-step process. This function makes it a one-step process.

You're actually allowed to pass in $null and an empty string. If you do, you'll get $null and an empty string back.

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
Value String[]

The base-64 string to convert.

true true (ByValue)
Encoding Encoding

The encoding to use. Default is Unicode.

false false ([Text.Encoding]::Unicode)

EXAMPLE 1

ConvertFrom-Base64 -Value 'RW5jb2RlIG1lLCBwbGVhc2Uh'

Decodes RW5jb2RlIG1lLCBwbGVhc2Uh back into its original string.

EXAMPLE 2

ConvertFrom-Base64 -Value 'RW5jb2RlIG1lLCBwbGVhc2Uh' -Encoding ([Text.Encoding]::ASCII)

Shows how to specify a custom encoding in case your string isn't in Unicode text encoding.

EXAMPLE 3

'RW5jb2RlIG1lIQ==' | ConvertTo-Base64

Shows how you can pipeline input into ConvertFrom-Base64.