SQL Server Management Studio (SSMS) maintains a list of previously connected servers in the Windows Registry under these locations:
HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\XX.0_Config\Servers HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\XX.0\Tools\Shell\Servers
Where XX.0
corresponds to your SSMS version (e.g., 18.0 for SSMS 18). Each server is stored as a separate REG_SZ value.
To remove unwanted server entries:
- Press
Win + R
, typeregedit
- Navigate to either path mentioned above
- Right-click the incorrect server name and select Delete
Warning: Always back up your registry before making changes!
For bulk removal or frequent maintenance, use this PowerShell script:
# Remove single server entry Remove-ItemProperty -Path "HKCU:\Software\Microsoft\SQL Server Management Studio\18.0_Config\Servers" -Name "OldServerName" # Remove all servers Get-ChildItem -Path "HKCU:\Software\Microsoft\SQL Server Management Studio\18.0_Config\Servers" | ForEach-Object { Remove-ItemProperty -Path $_.PSParentPath -Name $_.PSChildName }
If you're uncomfortable with registry edits, tools like MRU-Blaster
or CCleaner
can clean SSMS connection history through their GUI interfaces.
To avoid accumulating incorrect server names:
- Use
ServerName\Instance,Port
format for precise connections - Consider using
Registered Servers
feature for organized connections - Regularly export your valid servers with
Export/Import Settings
in SSMS
Every SQL Server developer using SSMS has encountered this - that stubborn dropdown list in the "Connect to Server" dialog that keeps showing decommissioned servers, test instances, or mistyped server names. These entries persist even after the actual servers are long gone.
SQL Server Management Studio stores your connection history in two locations:
- Windows Registry:
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\140\Tools\Shell\SqlStudio\MRU
(Note: The "140" corresponds to SSMS 2017. For SSMS 2019 it would be "150")
- Configuration file:
%AppData%\Microsoft\SQL Server Management Studio\{version}\SqlStudio.bin
Here's how to remove unwanted entries:
:: Registry Method (PowerShell) Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Microsoft SQL Server\140\Tools\Shell\SqlStudio\MRU" -Name "ServerName\1" :: File Method (Command Prompt) del /q "%AppData%\Microsoft\SQL Server Management Studio\*\SqlStudio.bin"
For less technical users, you can manage recent connections through SSMS:
- Go to Tools > Options
- Navigate to Environment > General
- Under "Startup", set "At startup" to "Open empty environment"
- Restart SSMS
For teams needing regular cleanup, here's a PowerShell script:
# SSMS Connection History Cleaner $ssmsVersions = @("140","150") # SSMS 2017 and 2019 foreach ($version in $ssmsVersions) { $regPath = "HKCU:\Software\Microsoft\Microsoft SQL Server\$version\Tools\Shell\SqlStudio\MRU" if (Test-Path $regPath) { Get-ItemProperty -Path $regPath | Where-Object { $_ -like "*oldserver*" } | ForEach-Object { Remove-ItemProperty -Path $regPath -Name $_.PSChildName } } }