views:

11

answers:

1

Hey, I am currently developing a vbs script, which installs SQL server 2008 + SP1. After the install I want to change the default settings in the Ssms, such as "Prevent saving changes that require table recreation" and such on.

I can't figure out, where Ssms hides its settings. Currently I am looking at 1) My Documents\SQL Server Management Studio\ 2) HKCU\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\Profile

But whenever I change a "setting" in the vssettings-file in 1), Ssms thinks it is first time it runs, and overwrite.

How can I change the Ssms setting manual, without doing it from the Ssms itself?

A: 

Unfortunately, on first run SSMS has to rebuild configuration information, since that is the way VSShell is designed and SSMS2005 - SSMS2008R2 is built on a top of VS Shell.

I'm not 100% sure, but you can try to run SSMS /setup (runs without UI), that theoretically should trigger that rebuild.

SSMS stores settings in multiple places. Most of Tools->Options settings are stored in "C:\Users\\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin"

Which is binary serialization of the settings structure.

But if you reference "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Microsoft.SqlServer.Management.UserSettings.dll" assembly, you can access it programatically:

Console.WriteLine(Settings<SqlStudio>.Current.SSMS.Startup);
Settings<SqlStudio>.Save(true);

Please note, that this file doesn't exists right after installation, but if you instantiate the Settings object ans call Save method, it will be created and used.

TTRider