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):

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:

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 Emotion: crab.

... 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:

  1. At first you need to open the  "HKEY_LOCAL_MACHINESOFTWAREMicrosoftCommerce Server 2007" registry key (see screenshot: Figure-Program-Code-GetCS2007RegistryKey-004.png):
  2. Then you can read the current MSCS_Admin connection-string from the ADMINDBPS registry key and decrypt it with you machine key (see screenshot: Figure-Program-Code-GetConnectionString-003.png):
  3. In a last step you can store a new connection string to the ADMINDBPS registry key (see screenshot: Figure-Program-Code-SetConnectionString-002.png):

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.
  • CS-MSCSAdmin-ConnectionString.exe /?
  • CS-MSCSAdmin-ConnectionString.exe /get
  • CS-MSCSAdmin-ConnectionString.exe /set new-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 Emotion: metzgerporsche

Links


Mahalo.
 - Andreas

0 Comments so far
    Name:

    Website:


    Attachments

    File-Icon: image/png
    File-Icon: image/png
    File-Icon: image/png
    File-Icon: image/png
    File-Icon: image/png
    File-Icon: image/png
    File-Icon: image/png
    File-Icon: image/png
    File-Icon: image/png
    File-Icon: application/octet-stream
    File-Icon: text/plain
    File-Icon: application/x-msdownload