Decrypting a System.Security.SecureString.

Sometimes it’s useful to be able to decrypt a System.Security.SecureString.

For example recently I was writing a script to change root passwords. I needed the user to enter a new root password twice and compare them to check the passwords matched.

Below a function to do decrypt the System.Security.SecureString to plain text.

you can use the

to see usage examples