Skip to content

Instantly share code, notes, and snippets.

@maravedi
Created September 7, 2019 18:45
Show Gist options
  • Save maravedi/9bc0782049d5e64673949c838ce15675 to your computer and use it in GitHub Desktop.
Save maravedi/9bc0782049d5e64673949c838ce15675 to your computer and use it in GitHub Desktop.
PowerShell Base64 Encode
# Examples:
# 'Test' | Get-Base64EncodedString
# Get-Base64EncodedString 'Test'
# Get-Base64EncodedString -String 'Test'
Function Get-Base64EncodedString {
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline = $True)]
[String]$String
)
Return [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($String))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment