Powershell – Base64 in Text in Base64

Lesedauer < 1 Minute

#Text in Base64
$Text = Read-Host -Prompt ‘Text in Base64’
$Uni = [System.Text.Encoding]::Unicode.GetBytes($Text)
$Hex = [Convert]::ToBase64String($Uni)
echo “$Hex”

#Base 64 in Text
$Text = Read-Host -Prompt ‘Base64 in Text’
$Hex = [Convert]::FromBase64String($Text)
$Uni = [System.Text.Encoding]::Unicode.GetString($Hex)
echo “$Uni”