I recently helped an IT guy fix an issue where the SCCM client agent could not discover the site code. Manually entering the 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, all the client agents in the setup could not discover the side code. 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 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.
Troubleshooting SCCM Client Site Code Discovery Issue
In the new SCCM setup, 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.
Clicking the Components tab showed most of the components as Installed however the CCM notification agent status was Disabled.
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 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.
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).
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.
SCCM Client Site Code Discovery
So the client agents in the new setup were still assigned to site code of old setup. 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.
I changed the value of GPRequestedSiteAssigmentCode key from USA to new site code.
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.