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 SCCM 2012 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.
Configuration Manager Client Site Code
Before you change site code of Configuration Manager client, let’s look at some rules. 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.
Change Site Code of Configuration Manager Client
Now we will see how to change site code of Configuration Manager 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" 'end if 'Assign client to Servername oSMSClient.SetAssignedSite "P01",0 set oSMSClient=nothing
If you want to change site code of Configuration Manager client on 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 > 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.
Deploy Change Site Code Script
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. Select the collection and 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.