Skip to content

Instantly share code, notes, and snippets.

@marcgeld
Created April 5, 2017 09:27
Show Gist options
  • Save marcgeld/160dc0c917703b9256548429a66184b0 to your computer and use it in GitHub Desktop.
Save marcgeld/160dc0c917703b9256548429a66184b0 to your computer and use it in GitHub Desktop.
Powershell: base64 encode / decode
# base64 encode / decode
$bytes = [System.Text.Encoding]::UTF8.GetBytes( "Write-Host Hello World")
$base64 = [Convert]::ToBase64String( $bytes )
Write-Host "Base64 encoded: "( $base64 )
$base64Decoded = [Convert]::FromBase64String( $base64 )
Write-Host "Base64 decoded: "( $base64Decoded )
$decodedText = [System.Text.Encoding]::UTF8.GetString( $base64Decoded )
Write-Host "Base64 decoded string: "( $decodedText )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment