Archive

Posts Tagged ‘Encode’

Encoding & Decoding Base64 using PowerShell

November 4, 2018 Leave a comment

# Encode string using Base64

$Text = "This was encoded using Base64"

$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text)

$Encoded = [Convert]::ToBase64String($Bytes)

$Encoded

# Decode Base64 to string

$Base64 = "VABoAGkAcwAgAHcAYQBzACAAZQBuAGMAbwBkAGUAZAAgAHUAcwBpAG4AZwAgAEIAYQBzAGUANgA0AA=="

$Decoded = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($Base64))

$Decoded

Advertisements
%d bloggers like this: