I was busy with an SCCM migration recently. A Customer wanted to get gradual side-by-side migration from an old SCCM 2012 R2 to a shiny SCCM CB.
The issue I faced was related to a Client re-assignment from the old to the new SCCM site.
As recommended I tried Jason Sandy’s script to reinstall the old client and configure the new one for the new site.
The Client was successfully installed, but kept connect to the old site.
I tried to re-register site assignment in WMI as described https://prajwaldesai.com/change-site-code-of-configuration-manager-client/ and restart CCMEXEC service.
In ClientLocation log I saw the new site was assigned, MP found, but after that the site immediately was re-assigned to an old one and the Client tried to connect back to the old site
I tried completely uninstall the client, use push etc.. without success.
Finally I noted
|LSRefreshSiteCode: Group Policy Updated the assigned site code <old site code>, which is different than the existing assigned site code <new site code >. Will attempt re-assignment.
I checked GPOs and found a disabled GPO containing SCCM ADMX template with a site assignment.
The matter in fact once applied GPO tattoes its settings in the registry and they remains there even if GPO is not active anymore.
So I opened GPO template (located in ConfigMgr installation folder\Tools\ConfigMgrADMTemplates and founf the registry key in question is “hklm\SOFTWARE\Microsoft\SMS\Mobile Client”. Originally I planned to change only site code value there, but found Henrik’s article where he recommended to remove all values from the key all together.
Probably both approaches can work, so I created a simple cmd script and pushed it from the SCCM
REG delete “hklm\SOFTWARE\Microsoft\SMS\Mobile Client” /v GPRequestedSiteAssignmentCode /f
REG delete “hklm\SOFTWARE\Microsoft\SMS\Mobile Client” /v GPSiteAssignmentRetryDuration(Hour) /f
REG delete “hklm\SOFTWARE\Microsoft\SMS\Mobile Client” /v GPSiteAssignmentRetryInterval(Min) /f
first three commands are cleaning settings hardcoded by GPO, the forth one force SCCM site code using a VBS script from here
After the script finished I restarted ccmexec and fount the client registered in the new site successfully.