Monday, March 26, 2012

Installed client uses old SiteCode

Site Code Woes

The Problem
I encountered a problem where when I would install the Config Mgr client on computers, the client would use a site code of a previous Config Mgr implementation. The client is installed using the SITECODE=AUTO which should have set the site code to HSC however after the installation, the CCM\LocationServices.log would show a sitecode of HS1.

LocationServices.log
3/27/2012 11:11:20 AM 1352 (0x0548) LocationServices LSRefreshSiteCode: Group Policy Updated the Assigned Site Code <HS1>, which is different than the exisitng assigned Site Code <>. Would try to re-assign the site.
3/27/2012 11:11:20 AM 1352 (0x0548) LocationServices Sending Fallback Status Point message, STATEID='500'.
3/27/2012 11:11:20 AM 1352 (0x0548) LocationServices Processing GroupPolicy site assignment.
3/27/2012 11:11:20 AM 1352 (0x0548) LocationServices Assigning to site 'HS1'
3/27/2012 11:11:20 AM 1352 (0x0548) LocationServices LSVerifySiteVersion : Verifying Site Version for <HS1>
3/27/2012 11:11:20 AM 1352 (0x0548) LocationServices LSGetSiteVersionFromAD : Failed to retrieve version for the site 'HS1' (0x80004005)


The Cause
The issue is the client had been previously installed using a Group Policy Object and had used a static sitecode of HS1 instead of AUTO. This caused the following entries to be written to the registry.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client]
"GPRequestedSiteAssignmentCode"="HS1"
"GPSiteAssignmentRetryInterval(Min)"=dword:0000003c
"GPSiteAssignmentRetryDuration(Hour)"=dword:0000000c

Unfortunately whenever the client is uninstalled these entries are not removed and worse still they override future install values.

The Fix
Delete these three values and reinstall the client. If you have many to do you can write a script like this one and run it via login script or GPO.

'Written By: Timothy Henning
'Written On: 9/18/2011
'Delete SMS Site code in registry
Option Explicit
Dim RegPath
Set RegPath = WScript.CreateObject("WScript.Shell")
RegPath.RegDelete "HKLM\Software\Microsoft\SMS\Mobile Client\GPRequestedSiteAssignmentCode"
RegPath.RegDelete "HKLM\Software\Microsoft\SMS\Mobile Client\GPSiteAssignmentRetryInterval(Min)"
RegPath.RegDelete "HKLM\Software\Microsoft\SMS\Mobile Client\GPSiteAssignmentRetryDuration(Hour)"