Change Site Code of Configuration Manager Client In this short post we will see how to change site code of Configuration Manager client. Every site has a site server, a site database, and a three-character alphanumeric site code. The site code must be unique in the hierarchy. Site codes are used to identify the sites in a Configuration Manager and site code must uniquely identify each Configuration Manager site in the hierarchy. Having said that there might be reasons why you want to change the site code of the configuration manager client. Let’s assume you have ConfigMgr 2007 installed in your company and now you want to migrate the objects to Configuration manager 2012. ConfigMgr 2007 and System Center 2012 Configuration Manager publish information into the same Active Directory system folder when implemented in the same domain. As a part of the migration process, you should plan for new site codes for your System Center 2012 Configuration Manager hierarchy.
When you are choosing the site code while installing SCCM you should keep few things in mind.
1) Avoid using reserved names such as AUX, CON, NUL, PRN when choosing site codes. Click this link to see list of reserved file names.
2) Avoid reusing site codes previously used in your ConfigMgr hierarchy. Configuration Manager Setup does not verify that the site code entered is not already in use. Site codes are stored in the site databases. If you were to reuse a site code, you may discover that all references to the old site were not fully removed or are re-introduced from a restored backup. This could cause problems resolving the site.
Change Site Code of Configuration Manager Client
Now we will see how to change site code of SCCM client using a script. In the below script replace your site code in place of P01 and save it as filename.vbs. The script can be downloaded here.
On Error Resume Next
set oSMSClient = CreateObject ("Microsoft.SMS.Client")
'if Err.Number <>0 then
'wscript.echo "Could not create SMS Client Object - quitting"
'Assign client to Servername
If you want to change the site code on a single computer then copy the script to the computer and run the script. If you are looking to change the site code for set of computers then let’s see how to do that. Launch the configuration manager console, navigate to Software Library and click on Packages. Right Packages and click Create Package.
Specify the Name and Source folder of the package. Click Next.
Create a standard program and specify the details such Name, command line etc. Click Next.
Complete the rest of the steps and click Close.
After you create this package you need to distribute the package to the DP. Once the package is available with the distribution point, right the package and click Deploy. Choose the collection to which the package is to be deployed. Click Next.
Choose the purpose as Required or Available. Click Next.
To schedule the deployment click on New and click As soon as possible. Click Next.
Complete the remaining steps and click Close.
After few minutes login to the client computer and check the configuration manager properties. Click General tab and under client properties we see that the site code is changed to P01 (as per the script).
For troubleshooting purpose you can view the execmgr.log file.