Convert-secure string not working after user profile changed

I created a script to use the password from text file which encrypted using secure-string. user profile which used to run the script got corrupted hence created new user profile. after that I am getting error on converting secure string . to resolve the issue again created a encrypted password text file.

is this normal scenario ? if we change the profile do we have to re-create the encrypted password file ?

how to avoid this?

It depends … but probably β€œyes”. :wink: If you use ConvertTo-SecureString or ConvertFrom-SecureString without the parameter -Key or -SecureKey it will use a key derived from this particular user profile of this particular computer. It would be even different for the same user but on a different computer.

To read some more:

1 Like