During a recent ConfigMgr side by side migration project i needed a way to reassign clients from an old site to new. On a number of machines the client had hard coded the site code into the registry either manually or via Group Policy. If the group policy is removed the site code remains static in the registry, this is obviously an issue when migrating clients to a new site.
Jason Sandys has a great client remediation start up script that can be deployed via Group Policy, this script should be considered regardless of whether you are planning a site migration. – https://home.configmgrftw.com/configmgr-client-startup-script/
In addition, Anders Roland has a great client health script to actively remediate client issues. – https://www.andersrodland.com/
The site to be migrated had a large number of clients therefore clients were migrated on an AD site by site basis. In each case, Jasons start up script was configured to reassign clients that were offline at the time (these clients would get the reassignment script at startup and move over), in addition to this startup script i deployed Group Policy Preferences to remove the troublesome registry keys.
I wrote a simple PS script to migrate online clients from the old site to new, this script was placed on a share and deployed on the old site as a required program.
Change the value of $DesiredSiteCode to your new site code and deploy the script from your old site required for clients, if the site code is not a match the client will be reassigned. If a client is deemed to require reassignment it will remove the hard-coded site registry values if they are found. Reassigned clients are logged and will show if the registry remediation was required or not.
If you enable automatic client upgrade on your new site, clients will automatically upgrade within the defined period.