[Solved] Input string was not in a correct format

When you want to convert a string to a secure string with ConvertTo-SecureString, you may get the following error message

ConvertTo-SecureString : Input string was not in a correct format

This happens when you try to convert a regular string to a secure string.
Converting to a secure string only means “to protect in memory”.

However, the standard input for the ConvertTo-SecureString cmdlet is an encrypted string.

As a workaround you can use the AsPlainText parameter, which has to be associated with the Force parameter (to confirm you understand the implications).

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s