Thursday, May 17, 2012

How to encapsulate a value in quotes

Many times I get a list of hostnames from someone requesting a software distribution. Rarely are the values in encapsulated with quotes and separated by commas as is required by SCCM's collection query.

Well sometimes all you have to do is ask. Here is a simple Excel formula which will take the hostname value from one cell and encapsulate it in quotes and append a comma.

=CONCATENATE(CHAR(34),A1,CHAR(34),",")

Place the formula in cell A2 where A1 equals the cell with the hostname. Then simply click the bottom right corner of cell A2 and drag it downward the same number of rows as A1. This will create your new values that you can simply copy and paste into your WQL query.

Much Thanks to Jon Scruggs!


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)"