Manually setting the Commerce Server's connection string to the MSCS Admin database

If you want to quickly change the connection string to the MSCS_Admin database of your Commerce Server 2007/2009 installation you can do this with a really simple console application. With only a couple lines of code you can simply read and write (decrypt and encrypt) the connection string stored in your Windows registry.
created by on 2010-02-03

The ADMINDBPS Registry Key

The Microsoft Commerce Server 2007 (and I guess Commerce Server 2009 as well) holds the connection string to its main administration database (the MSCS_Admin database) in the Windows registry (see screenshot: Screenshot-CS-MSCSAdmin-ConnectionString-Registry-Key-CS-2007-ADMINDBPS-Binary-005.PNG):

Screenshot of the Windows registry key that holds the Commerce Server 2007 connection string to the MSCS_Admin dabase: ADMINDBPS. The value stored in the ADMINDBPS key is encrypted with the machine key. (Keywords: Commerce Server 2007, Screenshot, Tutorial )

The path to the registry key is HKEY_LOCAL_MACHINESOFTWAREMicrosoftCommerce Server 2007ADMINDBPS and its value cannot be displayed directly because it is encrypted with the machine key.

Why change the connection string?

My collegues and I recently ran into a little issue when updating a Commerce Server 2007 installation to Service Pack 2. We had to change the connection string to a named instance of SQL Server 2005, but we quickly realized that the tool for performing this task, the CSConfig.exe, does not support named instances of SQL Servers:

A screenshot of the CSConfig.exe Dialog for selecting the location of the Commerce Server 2007 Administration Database (MSCS_Admin). (Keywords: Commerce Server 2007, Screenshot, Tutorial )

Obviously it is not the Commerce Server itself that cannot handle instance names using non-standard ports, but the CSConfig tool that cannot handle the syntax of connection strings with named instances (and/or non-standard ports). So we figured, we could write our own little CSConfig which is capable of doing just that.

And with a little help of Lutz Roeder’s .NET Reflector and the FileDisassembler plugin this was just about 5 minutes of development 🐝 .

… Anonther reason why this solution might come in handy is the development with different Commerce Server environments. With a little console application you can quickly change your database connection strings from your local machine to a remote TEST-environment.

What you need to do to read or write the MSCS_Admin connection string:

Using the “CS-MSCSAdmin-ConnectionString.exe” console application

I combined these three functions into a little console application which can be used to get or set the MCSCS_Admin database connection-string.

Download the code and/or the application

If you think you can use the code or the little console application feel free to use it and drop me a line 🚀


– Andreas