Fix Commerce Server 2007 After Renaming Machine Name
There are time you have to change your machine name post a Commerce Server 2007 installation and after doing so you render your Commerce Server in operable. No matter what your scenario is I will give you two solutions. These solutions are recommended for single server deployments only.
Supported Solution
The supported solution only works for a very few scenarios for example, your Enterprise images Development Systems to prepare a computer for doing imaging and customization. Install Commerce Server but do not configure it, then make an image of the system. After installing the imaged system on to a computer run the Commerce Server Configuration.
Non Supported Solution
The non supported solution is exactly as it is, you will not get any support if you follow these steps. Now that I have made that disclaimer lets get down and dirty.
MSCS_Admin Database
Commerce Server holds all site configuration in MSCS_Admin database. This Database is created when you first configure your site and every time you unpackaged a site all it's configuration data will be stored in MSCS_Admin database. So how is it that MMC Console or Commerce Server knows where this database resides? That's a good question. Commerce Server holds the connection string for MSCS_Admin database in the registry key ADMINDBPS, this key is encrypted.
The Commerce Server MMC and the Configuration objects get the connection string from this location, to find the MSCS_Admin database. After configuration Commerce Server and un-packaging one more site(s), Server names and connection strings for a Commerce Site is held in this database. Hence if the machine name is changed post installation, the connections between resources might break and these connection strings needs to be changed manually.
Recovering Commerce Server After Machine Name Change
Change the Commerce Server Administration database connection string. You can do by running CSConfig.exe command with /f command line to re-configure Commerce Server. This will also reset Service accounts for Commerce Server.
Some global resources such as the Data Warehouse, Commerce Server Direct Mailer, and Profiles may have display names containing the server name on which they were created. So we need to fix this by updating the MSCS_Admin database and replace the old server name with a new one. Then we need to change all the connection strings.
Before doing any changes lets understand a few tables relevant to our updates in MSCS_Admin database. The Commerce Site information is held in several tables. The Site Table holds the Site Name and by joining to SiteResources and Resources Table we can get a list of Resources associated with a particular site. To see the detail properties of the Resource we need to join to ResourceProps Table. So most of the data is held in Resources table and ResourcesProps and these are the two table we need to modify. First we need to update the Resources Table's s_Computer column. This columns holds the global display name which are server names. Next We need to update the ResourceProps Table s_Value column this table holds all of the connection strings and for some resources it holds server names as well.
The following scripts is to be executed under the MSCS_Admin database:DECLARE @OldMachineName nvarchar(255)DECLARE @NewMachineName nvarchar(255)
SET @OldMachineName = null -- name of your old computer SET @NewMachineName = null -- name of your new computer
IF @OldMachineName is not null AND @NewMachineName is not nullBEGIN UPDATE ResourceProps SET s_value=REPLACE(CONVERT(nvarchar(4000),s_value),@OldMachineName,@NewMachineName )
UPDATE Resources SET s_DisplayName = REPLACE(s_DisplayName,@OldMachineName,@NewMachineName ) , s_Computer = REPLACE(s_Computer,@OldMachineName,@NewMachineName) END
Next we need to fix the profiles global connection strings. The following statement needs to be executed under the <SiteName>_Profiles database.
DECLARE @OldMachineName nvarchar(255) DECLARE @NewMachineName nvarchar(255)
SET @OldMachineName = null -- name of your old computer SET @NewMachineName = null -- name of your new computer
IF @OldMachineName is not null AND @NewMachineName is not nullBEGIN Update SourceDef SET ConnStr = REPLACE(ConnStr,@OldMachineName,@NewMachineName) END
Also run the following SQL statement for Direct Mailer if you have it installed.
DECLARE @NewMachineName nvarchar(255)
SET @NewMachineName = null -- name of your new computer
IF @NewMachineName is not nullBEGIN
UPDATE Resources SET s_Computer = @NewMachineName WHERE (s_Type = 'DirectMailer') AND (f_IsGlobal = 'true')
END
Update all of your Business User Management Applications so that they are pointing to the new machine name.
Also update local SQL accounts from OldMachineName\UserName with NewMachineName\UserName.
Summary
So you now have two solutions you can test in your Enterprise to ease you deployment pains.
Comments
Anonymous
December 14, 2006
Hi, i followed the steps of your article to fix commerce server after renaming the machine name and as i am verifying that everything still works as before, i find the Customer and Order manager doesn't open. It complains about the Orders Web Service is unavailable but when I try to view it in internet explorer, it seems to be available since I can invoke one of the method. I already changed the connection string of the business application to the new machine name. Any idea? Is there anywhere else that i need to change the machine name...specifically for OrdersWebService? Thanks!Anonymous
December 14, 2006
Yes this has to do with the SSL certifricate. You will need to remove the certificate and recreate it. Good luck, -MaxAnonymous
January 05, 2007
I had Commerce Server 2007 running on a Virtual Machine. I made a copy of the Virtual Machine, ranamed it, and followed the non-supported solution you outlined. I can not get into the Commerce Server Manager, I keep getting the error "Snap-in failed to initialize." Thanks for your help.Anonymous
January 06, 2007
Did you follow step one by running "CSConfig.exe command with /f"?Anonymous
March 05, 2007
The comment has been removedAnonymous
March 05, 2007
I have not tested this with the new sid utility. So, looking at the error message it seems that the objects are not configured correctly. You will need to run a repair first, and then try to configure Commerce Server. Good luck, -MaxAnonymous
March 19, 2007
I have meet the same problemAnonymous
April 13, 2007
How does one fix a CS2007 install if you've added host headers to the web server post CS2007 install?Anonymous
April 13, 2007
The comment has been removedAnonymous
June 20, 2007
A bug was fixed to address the direct mailer issues on the post hope it will be of help to you guys who have been having issues. -MaxAnonymous
August 21, 2007
The comment has been removedAnonymous
August 21, 2007
This is really targeted towards CS2007 I haven't done any testing for CS2002. Once you cleared the registry key then open the MMC console and reconnect. -Max