Failed to read assigned Site Code from Registry Error Code 0x80070002

While installing SCCM client on a remote machine, I encountered failed to read assigned site code from registry error code 0x80070002. Let’s see how to fix this error.

I usually install the SCCM client agents using the client push method. However on one of my machine client agent install failed. I also tried to manually install the ConfigMgr agent and it still failed.

When I started to review the log files, the first log file ccmsetup.log looked fine except one error. Failed to read assigned site code from registry error code 0x80070002.

Apart from that error, I didn’t find any major errors in any of the log files that I normally use for troubleshooting.

I noticed that Configuration Manager client agent wasn’t installed completely. It had only 2 cycles under Actions tab. Machine Policy retrieval and evaluation & User Policy retrieval and evaluation cycle.

On the General tab of ConfigMgr properties, I saw the client certificate was set to value None.

Configuration Manager client missing action cycles
Configuration Manager client missing action cycles

Furthermore I also saw ccmsetup is exiting with return code 0 at the end of ccmsetup.log. That line usually means the client agent installed successfully. However that doesn’t mean the client agent runs correctly without any errors.

"Failed

Failed to read assigned Site Code from Registry Error Code 0x80070002

In case you are seeing Failed to read assigned Site Code from Registry Error Code 0x80070002 and if your ccmsetup.log entries look similar to the below one, then this post should help you.

Updating MDM_ConfigSetting.ClientDeploymentErrorCode with value 0 ccmsetup
Failed to read assigned site code from registry. Error code = 0x80070002 ccmsetup
Raised pending client deployment state message. ccmsetup
Deleted file C:\Windows\ccmsetup\ccmsetup.cab.download ccmsetup
Deleted file C:\Windows\ccmsetup\ccmsetup.xml ccmsetup
Task 'Configuration Manager Client Upgrade Task' does not exist ccmsetup
Clearing ClientDeploymentErrorCode reg key... ccmsetup
CcmSetup is exiting with return code 0 ccmsetup

Comparing the registry entries of a working machine against the problematic one, it revealed a missing key – AssignedSiteCode. Usually this key is created along with the client installation. However I believe in my case the key wasn’t created. So I decided to create this key manually.

Note – Backup your registry before making any changes. I always recommend this because if something goes wrong, you can always restore from the backup.

On the client computer, open the registry editor. Go to location – HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client.

Notice that the AssignedSiteCode key is present on the working machine while the key is not created on problematic computer.

AssignedSiteCode Registry Key
AssignedSiteCode Registry Key

Right click Mobile Client and click New > String Value.

Create new Registry Key AssignedSiteCode
Create new Registry Key AssignedSiteCode

Ensure the Value Name is AssignedSiteCode and value data is your SCCM site code.

Create new Registry Key AssignedSiteCode
Create new Registry Key AssignedSiteCode

After adding the above registry key, close the registry editor. I pushed the client agent on to this machine. And then the client agent installed successfully.

This simple trick worked for me and I hope it works for you as well.

Site Code Registry Error Code 0x80070002 Fixed
Site Code Registry Error Code 0x80070002 Fixed

3 Comments

  1. Hi, I have the same problem, I am trying to follow your guide to rectify the problem with pushing the client to the various machines do I have to do this on all the machine? or on the sccm server alone and then this will apply to all the machine
    Thanks

  2. Thank you so much for the help. I was trying to install the SCCM client manually on a new machine. I noticed the client agent was installed but the AssignedSiteCode registry key was missing. Created it and within few seconds the client was active. Your guides are the best !!

    1. Yes when you attempt to manually install the agent on a machine that hasn’t been discovered by ConfigMgr yet, you may add that reg key.

Comments are closed.