Skip to content

Test-Base64

SYNOPSIS

Determines whether a given string is a valid base64-encoded string.

SYNTAX

__AllParameterSets

Test-Base64 [-Base64String] <string> [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

This function checks whether the provided string is a valid base64-encoded string. It attempts to decode the input using [Convert]::FromBase64String(). If the decoding succeeds, it returns $true; otherwise, it returns $false.

EXAMPLES

EXAMPLE 1

Test-Base64 -Base64String 'U29tZSBkYXRh'

Output:

True

Returns $true as the string is a valid base64-encoded string.

EXAMPLE 2

'U29tZSBkYXRh' | Test-Base64

Output:

True

Returns $true as the string is a valid base64-encoded string.

PARAMETERS

-Base64String

The base64-encoded string to validate.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

{{ Fill in the Description }}

OUTPUTS

bool

{{ Fill in the Description }}

System.Boolean

{{ Fill in the Description }}

NOTES

Returns $true if the string is a valid base64-encoded string, otherwise $false.