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.
Tags:
2010Commerce Server 2007MicrosoftToolTutoriale-Commerce
- Tutorial, e-Commerce
- Tool, e-Commerce
- Tool, Tutorial
- Tool, Tutorial, e-Commerce
- Microsoft, e-Commerce
- Microsoft, Tutorial
- Microsoft, Tutorial, e-Commerce
- Microsoft, Tool
- Microsoft, Tool, e-Commerce
- Microsoft, Tool, Tutorial
- Microsoft, Tool, Tutorial, e-Commerce
- Commerce Server 2007, e-Commerce
- Commerce Server 2007, Tutorial
- Commerce Server 2007, Tutorial, e-Commerce
- Commerce Server 2007, Tool
- Commerce Server 2007, Tool, e-Commerce
- Commerce Server 2007, Tool, Tutorial
- Commerce Server 2007, Tool, Tutorial, e-Commerce
- Commerce Server 2007, Microsoft
- Commerce Server 2007, Microsoft, e-Commerce
- Commerce Server 2007, Microsoft, Tutorial
- Commerce Server 2007, Microsoft, Tutorial, e-Commerce
- Commerce Server 2007, Microsoft, Tool
- Commerce Server 2007, Microsoft, Tool, e-Commerce
- Commerce Server 2007, Microsoft, Tool, Tutorial
- Commerce Server 2007, Microsoft, Tool, Tutorial, e-Commerce
- 2010, e-Commerce
- 2010, Tutorial
- 2010, Tutorial, e-Commerce
- 2010, Tool
- 2010, Tool, e-Commerce
- 2010, Tool, Tutorial
- 2010, Tool, Tutorial, e-Commerce
- 2010, Microsoft
- 2010, Microsoft, e-Commerce
- 2010, Microsoft, Tutorial
- 2010, Microsoft, Tutorial, e-Commerce
- 2010, Microsoft, Tool
- 2010, Microsoft, Tool, e-Commerce
- 2010, Microsoft, Tool, Tutorial
- 2010, Microsoft, Tool, Tutorial, e-Commerce
- 2010, Commerce Server 2007
- 2010, Commerce Server 2007, e-Commerce
- 2010, Commerce Server 2007, Tutorial
- 2010, Commerce Server 2007, Tutorial, e-Commerce
- 2010, Commerce Server 2007, Tool
- 2010, Commerce Server 2007, Tool, e-Commerce
- 2010, Commerce Server 2007, Tool, Tutorial
- 2010, Commerce Server 2007, Tool, Tutorial, e-Commerce
- 2010, Commerce Server 2007, Microsoft
- 2010, Commerce Server 2007, Microsoft, e-Commerce
- 2010, Commerce Server 2007, Microsoft, Tutorial
- 2010, Commerce Server 2007, Microsoft, Tutorial, e-Commerce
- 2010, Commerce Server 2007, Microsoft, Tool
- 2010, Commerce Server 2007, Microsoft, Tool, e-Commerce
- 2010, Commerce Server 2007, Microsoft, Tool, Tutorial
- 2010, Commerce Server 2007, Microsoft, Tool, Tutorial, e-Commerce
Author:
Link:
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
... 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:
- At first you need to open the "HKEY_LOCAL_MACHINESOFTWAREMicrosoftCommerce Server 2007" registry key (see screenshot: Figure-Program-Code-GetCS2007RegistryKey-004.png):

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

- 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 lineLinks
- Fix Commerce Server 2007 After Renaming Machine Name
- Using Commerce Server Configuration Tools
- Accessing Microsoft Commerce Server Connection Strings
- .NET Reflector
- Reflector.FileDisassembler
Mahalo.
- Andreas
0 Comments so far
Attachments
File-Icon: image/png
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.
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
39.56 kB
File-Icon: image/png
Screenshot-CS-2007-CSConfig-Configuration-Wizard-Connection-String-005.PNG
A screenshot of the CSConfig.exe Dialog for selecting the location of the Commerce Server 2007 Administration Database (MSCS_Admin).
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
18.36 kB
File-Icon: image/png
Figure-Program-Code-GetCS2007RegistryKey-004.png
Function RegistryKey GetCS2007RegistryKey(): Retrieve Commerce Server 2007 Registry-Key
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
547.10 kB
File-Icon: image/png
Figure-Program-Code-GetConnectionString-003.png
Function GetConnectionString(RegistryKey key): Read the MSCS_Admin connection-string from the Registry and decrypt it with the local machine key.
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
1.29 MB
File-Icon: image/png
Figure-Program-Code-SetConnectionString-002.png
Function bool SetConnectionString(RegistryKey key, string value): Encrypt the new connection string and write it back to the ADMINDBPS registry key.
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
769.00 kB
File-Icon: image/png
Screenshot-CS-MSCSAdmin-ConnectionString-Info-Option-001.PNG
Console application CS-MSCSAdmin-ConnectionString.exe: Options and usage
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
9.28 kB
File-Icon: image/png
Screenshot-CS-MSCSAdmin-ConnectionString-Get-Option-002.PNG
Console application CS-MSCSAdmin-ConnectionString.exe: Use the get-option to retrieve current MSCS_Admin connection string from the Windows registry
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
7.67 kB
File-Icon: image/png
Screenshot-CS-MSCSAdmin-ConnectionString-Set-Option-003.PNG
Console application CS-MSCSAdmin-ConnectionString.exe: Use the set-option to store a new MSCS_Admin connection string
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
7.68 kB
File-Icon: image/png
Figure-Program-Code-CS-MSCSAdmin-ConnectionString-001.png
A screenshot of the program code of the small console application which gets or sets the connection string of the Commerce Server administration database
Date:
Friday, 19 February 2010
Filetype:
image/png
Size:
4.13 MB
File-Icon: application/octet-stream
CS-MSCSAdmin-ConnectionString.7z
The CS-MSCSAdmin-ConnectionString.exe console application wrapped in a 7-zip archive
Date:
Friday, 19 February 2010
Filetype:
application/octet-stream
Size:
3.58 kB
File-Icon: text/plain
CS-MSCSAdmin-ConnectionString.cs.txt
The c# program code of the CS-MSCSAdmin-ConnectionString.exe console application which gets or sets the connection string of the Commerce Server administration database
Date:
Friday, 19 February 2010
Filetype:
text/plain
Size:
4.86 kB
File-Icon: application/x-msdownload
CS-MSCSAdmin-ConnectionString.exe
The CS-MSCSAdmin-ConnectionString.exe console application. The application has only two functions: 1) Get the existing MSCS_Admin connection 2) Set a new MSCS_Admin connection string
Date:
Friday, 19 February 2010
Filetype:
application/x-msdownload
Size:
11.78 kB
grab document data
sitemap.xml Manually-setting-CS2007-MSCS-Admin-database-connection-string.kml Manually-setting-CS2007-MSCS-Admin-database-connection-string.rss Manually-setting-CS2007-MSCS-Admin-database-connection-string.xml Manually-setting-CS2007-MSCS-Admin-database-connection-string.json Manually-setting-CS2007-MSCS-Admin-database-connection-string.print
sitemap.xml Manually-setting-CS2007-MSCS-Admin-database-connection-string.kml Manually-setting-CS2007-MSCS-Admin-database-connection-string.rss Manually-setting-CS2007-MSCS-Admin-database-connection-string.xml Manually-setting-CS2007-MSCS-Admin-database-connection-string.json Manually-setting-CS2007-MSCS-Admin-database-connection-string.print