Converts bytes or text to base64-encoded text.
ConvertTo-Base64.ps1 [-Data] <Byte[]> [-UriStyle] [-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertTo-Base64.ps1 [-Text] <String> [[-Encoding] <String>] [-UriStyle] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
ConvertTo-Base64.ps1 'username:BadP@ssword' utf8
dXNlcm5hbWU6QmFkUEBzc3dvcmQ=
Binary data to convert.
Type: Byte[]
Parameter Sets: BinaryData
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Text data to convert.
Type: String
Parameter Sets: TextData
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
The text encoding to use when converting text to binary data.
Type: String
Parameter Sets: TextData
Aliases:
Required: False
Position: 2
Default value: Utf8
Accept pipeline input: False
Accept wildcard characters: False
Indicates that the URI-friendly variant of the base64 algorithm should be used. This variant, as used by JWTs, uses - instead of +, and _ instead of /, and trims the = padding at the end to avoid extra escaping within URLs or URL-encoded data.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
https://docs.microsoft.com/dotnet/api/system.convert.tobase64string