To convert string value to base64 follow below steps in PowerShell commandline window:

Encoding to base64 string:

$encoded  = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("test"))
write-output $encoded

Output:

dGVzdA==

Decoding base64 string:

$decoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded))
write-output $decoded

Output:

test