Created
September 7, 2019 18:45
-
-
Save maravedi/9bc0782049d5e64673949c838ce15675 to your computer and use it in GitHub Desktop.
PowerShell Base64 Encode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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