It was time to upgrade to the latest OS and Visual Studio editions at work so why not start over clean, right? Right.
After backing up everything I needed I was off and running and re-loading all my beloved tools when it came time to import my old registered servers list. I thought I was clever; I backed it up "with login and password info" to make life easier. All was well until I imported the file and got the dreaded error message: "Key not valid for use in specified state"
Oh. No.
Of course, the servers then showed up but on closing and re-opening SSMS (2008 R2) my registered server list was blank. CRAP!
Luckily I knew where this info was stored and I navigated to %appdata%\Microsoft\Microsoft SQL Server\100\Tools\Shell\RegSrvr.xml
Upon opening the file in Notepad++ I jumped found the servers that had been setup with SQL Logins and started modifying...
- I removed the encrypted password and uid=xxx bits from the "ConnectionStringWithEncryptedPassword" element.
- I added "trusted_connection=true;" to the connection string modified in step 1
- I changed "PersistLoginNameAndPassword" to "PersistLoginName" in the "CredentialPersistenceType" element.
- I saved the file and crossed my fingers...
Success! I opened SSMS and had no error. My registered server list was intact and all was right with the world. Of course, the login info for a few servers will need to be corrected, but that's much less work than re-registering a pile of servers.
I hope this info will help others in the same boat :)
-A
9 comments:
Good article, it helped me much.
Small trick:
to replace all uid/password data , You can user regex replacement in Notepad++: pattern to find is:
uid=dba;password="[^"]+"
It works!
Perfect. Thanks a lot!!
Or just delete the file :)
I also had to rename (effectively remove) the following folders to stop the registered servers from coming back:
C:\Users\David\Documents\Visual Studio 2015\Settings\SQL Server Management Studio OLD\OLDNewSettings.vssettin
C:\Users\David\AppData\Roaming\Microsoft\Microsoft SQL Server\130\Tools\ShellOLD\OLDRegSrvr.xml
C:\Users\David\AppData\Local\Microsoft\SQL Server Management Studio\13.0 OLD
C:\Users\David\Documents\USB\Documents\Documents\SQL Server Management Studio\Settings\SQL Server Management Studio OLD
setup SSMS 16.3 - uninstall
remove directories
reinstall SSMS 16.3
ignore initial vssettings message. It will disappear next SSMS launch
Thanks heaps for this!
Just a note that I replaced steps 1 & 2 with just removing the encrypted passwords. That way I only have to reenter the passwords, not the usernames too.
A lot of thanks!!!
Thank you so much for this post. I had some older entries that when imported on a new device were causing an issue. Once I fired up that XML and deleted the invalid entries, my SSMS instance fires up with no errors. Thank you!
Thank you. All I needed to do is step 1 and 2. I've been storing the passwords in the description field. Not great, but it allows me to copy and paste it back into the empty password field after the import
Post a Comment