PowerShell : Encrypt Password in text file
Hello tout le monde,
Voici un petit bout de code PowerShell vous permettant de crypter les mots de passes que vous utilisez dans vos scripts.
read-host -prompt "Enter password to be encrypted in file.pwdt " -assecurestring | convertfrom-securestring | out-file file.pwd $pass = cat file.pwd | convertto-securestring $ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass) $pass_back = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($ptr) write-output "password decrpyted is: $pass_back"
