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.
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 is not always the case.
Failed to read assigned Site Code from Registry Error Code 0x80070002
In case you are facing the site code registry error code 0x80070002 and if your ccmsetup.log entries look similar to the below one, then this post is for 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 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.
Location – HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client
Right click Mobile Client and click New > String Value.
Ensure the Value Name is AssignedSiteCode and value data is your SCCM site code.
After adding the above registry key, 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.