8

SSMS allows us to use custom color for each connection.

Does anyone know where this information is saved? I'd like to keep the color setup but I keep losing it.

SSMS color coding

edit

When I connect from object explorer, I can set the color. However, this seems to be different from the colors that I set in registered servers, and this I keep losing. (Indeed, I am on a roaming profile.)

I use registered servers panel only when I do multi server operation and try to be much more careful when I have that panel open, so that's why I also want to be able to use colors associated with the object explorer.

Connect from object explorer

enter image description here

enter image description here

Thanks

7

After you have set up all of your registered servers the way you want them, you should be able to export the whole set under any server group by right-clicking the Local Server Groups node in View > Registered Servers and selecting Tasks > Export...

enter image description here

You can save individual servers or the whole lot. When you lose them, you can then import the file you backed up to reset them. I did not test (sorry, on the move) but this should save off all your servers, their credentials (which should be encrypted if present), and any personalized settings including custom colors.

(I suspect you are losing them because you are using a roaming profile or have some other AD/Group Policy perhaps resetting your profile.)

These settings are also stored in RegSrv.xml, which is going to be in a path something like:

C:\Users\<you>\AppData\Roaming\Microsoft\Microsoft SQL Server\<version>\Tools\Shell\

You will see lines like this, which you can change on the fly. I believe they will require a restart of Management Studio though, and you'll have to map your desired RGB color with the int equivalent (there are many calculators available online). Carriage returns added by me:

<RegisteredServers:UseCustomConnectionColor type="boolean">
  true
</RegisteredServers:UseCustomConnectionColor>
<RegisteredServers:CustomConnectionColorArgb type="int">
  -16777216
</RegisteredServers:CustomConnectionColorArgb>

The point is more that you can back up that RegSvr.xml file to save all your settings somewhere, and restore them whenever this happens. But you should also look into why this file is getting reset or why your profile gets re-created (that may be a question your system administrator can answer even if you can't).

The custom connection settings you set in the Connect to Server dialog are stored separately; these are in a file called SqlStudio.bin, in the following path:

C:\Users\<you>\AppData\Roaming\Microsoft\SQL Server Management Studio\<ver>

However, knowing where the file is will not really help you - the information about servers is largely not stored in a human readable format, and after connecting to a server with a custom color set, the change I saw when I performed a diff against the before and after files yielded nothing intelligible (and in fact I can't even confirm that that color change is saved there, except that when I open SSMS again it remembers it, like all the server credentials I've ever used). So:

  1. You can't very easily hand-modify the SqlStudio.bin file to put your chosen colors back in there.
  2. While it's possible you could back up your SqlStudio.bin file at a time when you've connected to your servers and SSMS currently remembers all of the settings, it would be missing anything else you've changed since you backed it up, so you might lose other things.

Therefore, I propose that it would just be much easier to just use registered servers, and stop manually setting a color when you connect, because with a moving profile you're constantly going to get SqlStudio.bin blown away (other things you can easily save off and import when that happens, e.g. fonts and colors).

With registered servers, you can keep a separate server group for the important servers where you want to be careful, and keep the other ones in a different group. And you can back them all up so it is easy to restore them on a different machine, when they get blown away, when your profile gets nuked again (or fixed), etc.

  • I fully agree. (Also, in SSMS 2014, it seems to remember the setting in registered server panel, even if I open only the object explorer. If so it is perfect.) Thanks for the help! – benik9 Sep 16 '15 at 2:03
0

Little late in the game but ApexSQL is a free tool which can be used for tab color based on environment. Coloring bottom part of SSMS was not so useful because it caught me off gaurd couple of times.

Hope this helps others scouting like me.

https://solutioncenter.apexsql.com/how-to-set-different-connection-colors-in-ssms/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.