When you want to convert a string to a secure string with ConvertTo-SecureString, you may get the
following error message
Reason
This happens when you try to convert a regular string to a secure string.
“Convert To Secure String” string only means “to protect in memory”.
However, the standard input for the ConvertTo-SecureString cmdlet is an encrypted string.
Workaround
As a workaround you can use the AsPlainText parameter, which has to be associated with the Force
parameter (to confirm you understand the implications).
$MySecureString = ConvertTo-SecureString -String $MyPlainTextString -AsPlainText -Force
Thank you!
LikeLike