Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Unable to read the encrypted password.

$
0
0
HiI used the below command to accept password. But unable to print the password entered.Please help me with the correct format to decrypt the password? I don't want to hard-code the password to my script.$SQLServiceAGTPassword = read-host "Enter a Password for SQL Agent AC:" -assecurestring | ConvertTo-SecureString -AsPlainText -Force$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SQLServiceAGTPassword)$RetrievePassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)Write-Host "Password is: " $SQLServiceAGTPassword

Viewing all articles
Browse latest Browse all 467

Trending Articles