Easy Guide to 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 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.

Change Site Code of Configuration Manager Client

Specify the Name and Source folder of the package. Click Next.

Change Site Code of Configuration Manager Client

Create a standard program and specify the details such Name, command line etc. Click Next.

Change Site Code of Configuration Manager Client

Complete the rest of the steps and click Close.

Change Site Code of Configuration Manager Client

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.

Change Site Code of Configuration Manager Client

Choose the purpose as Required or Available. Click Next.

Change Site Code of Configuration Manager Client

To schedule the deployment click on New and click As soon as possible. Click Next.

Change Site Code of Configuration Manager Client

Complete the remaining steps and click Close.

Completion step

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

Client Properties

For troubleshooting purpose you can view the execmgr.log file.

execmgr.log file

Need Assistance?

Send us a message or post your question in forums.

15 thoughts on “Easy Guide to Change Site Code of Configuration Manager Client”

  1. Hi,
    I would like to check is there a way to modify the SITECODE by editing the registry instead of using the VBS you provided in this guide above.
    Because my client is a standalone and only registry editing is allowed.

    Thank you

    Reply
  2. Hi, your guide are awesome and very easy to understand.
    However, I have a situation here. I’ve got several standalone machines which I install using the CMD line and I realized that the site code was wrong. May I find out if there is any way for me to amend the site code on these standalone (not connected to domain) machines?
    Thank you 😉

    Reply
  3. So we are removing one of our primary’s and moving the clients to a different existing one. We run this as a package and it completes. The site changes on the Client but not on the Cas or the primary’s. IF we run it manually as admin on the client it works and the machines show up on the new primary and is gone from the old one. Any idea what we could be doing wrong?

    Reply
  4. Hi Prajwal,

    I need a powershell script to check whether the client site code is correct or not (client machines are communicating with the correct primary site code or not) as i am very new to the powershell script, please get me a script on which i have asked and do the needful.

    Reply
  5. Hi Sir,
    I have site server A and site server B,in site A i have 3 forest domain, i have moved one domain to Site Server B. i have done discover and publishing now i can see the client in Site B,Is it possible to change the SITE code through SCCM or i need to create a group policy for this, please tell me any other way

    Reply
  6. Hi sir,

    Recently migrating server sccm 1806 but site code I used your script it’s worked manual but situation now my workstation not communicate with server but I need to deploy on all machine after run script need to do manual discover then I can get site code properly. So how can I discovered site by automation.. please suggest

    Reply
    • You need to first fix the connectivity issues between client and management point. The client agent must communicate with management point to download the policies. I suggest you check forums.prajwaldesai.com, there are some threads related to this issue.

      Reply
  7. Hi Prajwal,

    This script does nothing to me, below is the message I get in execmgr.log file

    CServiceWindowsEventHandler::Execute – Received SERVICEWINDOWEVENT : END EVENT
    Service startup.
    A user has logged on.
    The logged on user is XXXX

    That’s it. Appreciate your help here.

    Reply
      • I get the same error but it might have to do with the fact that I have an assigned management point. Do I need to uninstall the Management Point Role in order to get this fixed? Also Co-management Capabilities and Co-management are set to 1 and DISABLED respectively. I see in the example these configurations are not there. Does this mean that I need to change any of these?

        Reply
  8. Must be 2012.. his screenshots are of 2012, and his scenario was migrating from 2007 to 2012. What i don’t get is how do you already have a Windows 7 collection in the new site? Those machines must have been discovered first right? And if so, wouldn’t they already have the client installed, pointing them to the new site code?

    Reply
  9. Change Site Code of Configuration Manager Client,
    Hi, This process of deployment I am doing it in the old SCCM Server or in the new SCCM Server

    Reply

Leave a Comment