Fix SCCM Client Site Code Discovery Unsuccessful

In this post I will cover about SCCM client site code discovery unsuccessful. I recently helped an IT guy fix an issue where the SCCM client agent could not discover the site code. Manually entering the SCCM client site code and clicking Find Site showed Configuration Manager did not find a site to manage this client.

I had to first find out if this was the issue on all SCCM client agents or just one. As per this guy, the SCCM client site code discovery was unsuccessful on all computers. Finally when I asked him to give a background of SCCM setup, this is what he revealed.

So this guy had set up SCCM previously with a different SCCM client site code. It was a primary site with Management point and distribution point roles running on same server. On the same machine he installed SQL 2016 which had Configuration Manager DB on it.

Somehow he did not find things working well and he decided to uninstall the SCCM. Here is what actually went wrong. Instead of properly uninstalling SCCM, he deleted the VM on which SCCM was running. The client agents were still present on machines and had no way to contact Management Point.

After few days he created another VM and installed Configuration Manager 1902. This time while installing the SCCM, he used a new site code and noticed that SCCM client agents were not discovering the site code.

Configuration Manager did not find a site to manage this client
Configuration Manager did not find a site to manage this client

Troubleshooting SCCM Client Site Code Discovery Issue

In the new SCCM setup, the SCCM client site code discovery issues. I noticed that client agents were unable to discover the site code. I did a basic audit of SCCM setup and it was all good. I also upgraded the SCCM version 1902 to 1906.

So the actual issue was that a large number of SCCM clients were failing to report to the primary site. As part of the troubleshooting this, I picked an existing machine and initiated client push install. The installation went fine but checking the client properties showed something like this.

The General tab of Configuration Manager Properties showed the client certificate as None. Most of all there was no entry of assigned management point. You can see that under client properties there is not much of information as we normally see.

SCCM Client Properties

Clicking the Components tab showed most of the components as Installed however the CCM notification agent status was Disabled.

SCCM Client Components

Under Actions tab, there were just 2 actions and rest of them were missing.

  • Machine Policy retrieval and evaluation cycle.
  • User Policy retrieval and evaluation cycle.
SCCM Action Cycles

SCCM Client Logs

So from the above information it was clear that SCCM agent wasn’t contacting the management point. Now comes the most interesting part which is checking the log files on the client machine. You can refer all the SCCM log files for troubleshooting purpose here.

On the client machine I first opened the ClientIDManagerStartup.log. There was just one error logged several times – RegTask: Failed to refresh site code. Error: 0x8000ffff.

Unfortunately you cannot deduce anything from the above error message.

ClientIDManagerStartup.log
ClientIDManagerStartup.log

I opened the LocationServices.log file on the client machine. Here I noticed many errors and these errors are listed below.

Retrieved lookup MP(s) from DNS	LocationServices
Attempting to retrieve site information from lookup MP(s)
Failed to send site information Location Request Message to server
Failed to send site information Location Request Message to server
LSIsSiteCompatible : Failed to get Site Version from all directories
Won't send a client assignment fallback status point message because the last assignment error matches this one.
Failed to execute task 'LSSiteRoleCycleTask'. Error 0x80004005
CSiteRoleCycleTask::Execute failed (0x80004005).
Failed to execute task 'LSSiteRoleCycleTask'. Error 0x80004005
CSiteRoleCycleTask::Execute failed (0x80004005).
Failed to execute task LSSiteRoleCycleTask Error 0x80004005
Failed to execute task LSSiteRoleCycleTask Error 0x80004005

Scrolling down further I noticed another error :-

  • LSGetSiteVersionFromAD : Failed to retrieve version for the site ‘USA’ (0x80004005).
  • LSIsSiteCompatible : Failed to get Site Version from all directories
  • Won’t send a client assignment fallback status point message because the last assignment error matches this one.

This was interesting because USA was the old site code and the new site code was something else. This means the client agent was still assigned to the old site.

LSGetSiteVersionFromAD : Failed to retrieve version for the site 0x80004005
LSGetSiteVersionFromAD : LSGetSiteVersionFromAD : Failed to retrieve version for the site 0x80004005

Fix SCCM Client Site Code Discovery

So the client agents in the new setup were still assigned to site code of old setup. In other words the SCCM client site code discovery was unsuccessful. To verify this I checked all the group policy objects and disabled the ones that were not required.

I also cleaned the DNS records to ensure the old SCCM site server info doesn’t exists anywhere.

We know that there are several ways to assign a Configuration Manager client to a site. When you assign or reassign the client to a site by using Windows Group Policy, the site code is stored in a registry key on client computers.

Microsoft doesn’t tell you what registry key holds the site code information. I found that it was GPRequestedSiteAssigmentCode in the registry.

This key is located under HKLM\SOFTWARE\Microsoft\SMS\Mobile Client.

I noticed that this key contained the site code of the old site which was USA.

GPRequestedSiteAssigmentCode

I changed the value of GPRequestedSiteAssigmentCode key from USA to new site code.

GPRequestedSiteAssigmentCode

After making the above changes, I could see that SCCM client agent site code discovery was successful. The client agent started to communicate with management point and all the action cycles were seen in few minutes.

SCCM Client Site Code Discovery Successful
SCCM Client Site Code Discovery Successful

I hope this post helps you to fix the SCCM client site code discovery issues.

13 Comments

  1. How do you get Site code via CIM?

  2. BRILLIANT!!

  3. Avatar photo Gerhard Erasmus says:

    Thank you Prajwal ! I struggled for hours on client site and after your post boom. Thanks a million

  4. Avatar photo Graham Ormrod says:

    Thanks
    weirdly i had to create the registry key you suggested and it then worked straight away

  5. It helped a lot of your articles. Thank you bhai

  6. Avatar photo Michael Hufnagle says:

    I had the same issue when migrating to a new SCCM deployment with a different site code.

    The SCCM GPO templates do not do “Replace” for the variable, just “Create”. So to get this done, we ended up replacing it in a few areas of the registry for it to work smoothly for all actions:

    HKLM\SOFTWARE\Microsoft\SMS\MobileClient\AssignedSiteCode (Wouldn’t do anything on the Site tab in the Configuration Manager control panel properties window)

    HKLM\SOFTWARE\Microsoft\SMS\MobileClient\GPRequestedSiteAssignmentCode (the one you have above)

    HKLM\SOFTWARE\Microsoft\CCM\CcmEval\LastSiteCode (Wouldn’t run anything on Actions tab in Control Panel until we changed this one)

  7. Avatar photo Sandeep Chekuri says:

    Hi i need a power shell script to check whether client site code is correct or not (client machines are communicating with the correct primary site code or not) and i am very new to the Power shell

  8. It works ! Thank you Prajwal !

  9. Hello Prajwal,

    I always appreciate your very informative articles, they are very helpful! I’m having a similar issue of not getting automatic site assignment but it’s a different scenario. The site is clean and the only SCCM site we’ve ever had on this network. I have DNS publishing and the system folder permissions set to allow SCCM information in the schema. My main problem is recent master images for Citrix. It used to be that I give it a finishing task sequence that syspreps our AV solution and runs the “Prepare ConfigMgr Client for Capture”.

    It used to work just fine, Citrix would ingest the snapshot, do their own version of sysprep, and each VM of that machine catalog would pop up and assign automatically. Recently I found a few months ago that not to be happening, the SCCM GUIDs would replicate themselves. After banging my head against that issue for a long time I found I had to delete all certs in the personal certs store in order for it to not replicate the GUIDs. But ever since then, SCCM Client will not automatically pick the site up again. It is blank, and I either have to manually assign it in the control panel or push a client reinstall from the ConfigMgr console.

    I’m wondering why the sequence couldn’t properly prepare itself to be cloned, needing additional powershell to remove certificates, and why it will no longer pick up the site automatically? I investigated that registry entry like you have in this article, and while we haven’t applied site code via group policy, I do see the AssignedSiteCode key with the correct site in it. But the client doesn’t seem to realize that.

    ClientLocation.log shows that it see the correct AD Forest and Domain, that it is intranet, and that it attempts “Getting Assigned Site” but the Configuration Manager Properties still show “currently assigned to site code” as blank.

    If I click on Site>Configure Settings>Find Site, with nothing entered, it automatically finds the correct site code and says it has successfully found a site to manage the client. This time ClientLocation.log showed “Getting Assigned Site, Autodiscover Site, Client is set to use HTTPS when available. The current state is 480, and Got new site ***” Then it does it again, says client is currently not assigned to any site, removing client site assignments, Raising event: instance of CCM_RemoteClient_Reassigned, Client is now successfully assigned to site ***, discovers the default MP, and appears to be configured now.

    Edit: It also creates a whole new computer entry in SCCM, it doesn’t tie into the entry that was discovered from AD System discovery.

    If it was that simple, why would it not be able to do so automatically? What missing preparation is holding back from this autoconfig?

  10. —> Unable to connect to WMI (root\ccm) on remote machine error = 0x8004100e.

    Execute query exec [sp_CP_SetLastErrorCode] 2097152327, 0

    This are two error getting while push client from server this log ccm.log

  11. Hi

    Tried but no use

    Still i am getting same issue

  12. Avatar photo ravikiran says:

    Good artical

Comments are closed.