This PowerShell script imports saved connections from SQL Server Management Studio (SSMS) 21 to SSMS 22 by transferring the ConnectionMruList key from the privateregistry.bin file of SSMS 21 to SSMS 22. Thus helping you not waste time manually re-adding all your SSMS 21 connections to SSMS 22.
- Dynamically locates the SSMS version folders based on
sdk.txtfiles (in case you had the Preview for SSMS 21 and/or 22 installed at some point). - Backs up the SSMS 22
privateregistry.binfile before making any changes. - Exports the
ConnectionMruListkey from SSMS 21'sprivateregistry.binfiles. - Updates the exported registry key to match SSMS 22 and imports it into SSMS 22.
- Administrator Rights: The script requires elevated privileges to modify the registry and access the
privateregistry.binfiles. - SSMS 21 and SSMS 22 Installed: Both versions must be installed on the same machine.
- PowerShell: Built and tested for PowerShell 5.1 and newer.
-
Close SSMS: Ensure both SSMS 21 and SSMS 22 are closed before running the script.
-
Run the Script:
.\Import-SSMS21ConnectionsToSSMS22.ps1 -
Optional: Use the
-OSUserNameparameter to use a different user profile for the import.\Import-SSMS21ConnectionsToSSMS22.ps1 -OSUserName "OtherUser"
-
Follow Prompts: The script will prompt you to confirm before proceeding.
-
Verify Connections:
- Open SSMS 22 and check if your SSMS 21 connections have been imported successfully.
- Backup Files: The script creates backup copies of the
privateregistry.binfile before making changes. This is stored in the same directory as the original SSMS 22 file with a.bakextension. - Error Handling: If an error occurs, the script provides detailed error messages and you can use the previously generated backup to undo any changes.
If you encounter issues:
-
Close SSMS 22.
-
Restore the original
privateregistry.binfile for SSMS 22:Remove-Item -Path "path\to\privateregistry.bin" -Force Copy-Item -Path "path\to\privateregistry.bin.bak" -Destination "path\to\privateregistry.bin" -Force
-
Restart SSMS 22.
For more details, visit the Import Saved Connections from SSMS 21 to SSMS 22 blog post.