How to decrypt stored password from SSMS registered servers
Right click your server, choose tasks/export
Uncheck "Do not include user names and passwords in the export file"
Save the export to a file
Open the file in an editor and locate the tag RegisteredServers:ConnectionStringWithEncryptedPassword
Copy the contents of password attribute
Open powershell and paste the code below, after you amend it with your encrypted string.
$base64pass = "PasteEncryptedPasswordHere"
[System.Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
[System.Text.Encoding]::Unicode.GetString([System.Security.Cryptography.ProtectedData]::Unprotect([System.Convert]::FromBase64String($base64pass), $null, [System.Security.Cryptography.DataProtectionScope]::CurrentUser))
Uncheck "Do not include user names and passwords in the export file"
Save the export to a file
Open the file in an editor and locate the tag RegisteredServers:ConnectionStringWithEncryptedPassword
Copy the contents of password attribute
Open powershell and paste the code below, after you amend it with your encrypted string.
$base64pass = "PasteEncryptedPasswordHere"
[System.Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
[System.Text.Encoding]::Unicode.GetString([System.Security.Cryptography.ProtectedData]::Unprotect([System.Convert]::FromBase64String($base64pass), $null, [System.Security.Cryptography.DataProtectionScope]::CurrentUser))
Comments