This action stops ccmexec service, makes a backup of existing SMSCFG.INI on all clients, creates a new one with a generated random GUID and then start ccmexec service. SCCM client will then report new GUID to its management point. Eventually a new resource record with new GUID will be created in SCCM database leaving the old record obsolete.

All the actions on the client side are actually executed by a dynamically generated VBScript file. The tool will first generate a script source and saves it in a file “%TEMP%\changeguid.vbs”. Additionally a batch file “%TEMP%\changeguid.bat” is created which will take care of stopping and starting CCMEXEC service and calling the VBS. Both files will be copied to target workstations (in %windir%\temp folder). Once there, the changeguid.bat will be executed locally on remote computer. SCCM CAT only schedules the script and doesn’t give any feedback about the results.

The generated script source will look like this:

On Error Resume Next
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell: Set objShell = CreateObject("WScript.Shell")
Dim TypeLib: Set TypeLib = CreateObject("Scriptlet.TypeLib")
strWinDir = objShell.ExpandEnvironmentStrings("%WinDir%")
strSMSCFGPath = strWinDir & "\SMSCFG.ini"
strGUID = Left(Trim(TypeLib.guid),38)
strGUID = Replace(strGUID,"{","")
strGUID = Replace(strGUID,"}","")
If objFSO.FileExists(strWinDir & "\SMSCFG.ini.old") Then
result = objFSO.DeleteFile(strWinDir & "\SMSCFG.ini.old", True)
End If
If objFSO.FileExists(strSMSCFGPath) Then
Set objFile = objFSO.GetFile(strSMSCFGPath)
objFile.Name = "SMSCFG.ini.old"
Set objFile = Nothing
End If
Set objSMSCFG = objFSO.OpenTextFile(strSMSCFGPath, 2, True)
objSMSCFG.WriteLine "[Configuration - Client Properties]"
objSMSCFG.WriteLine "SMS Unique Identifier=GUID:" & UCase(strGUID)
Set objSMSCFG = Nothing
Set objFSO = Nothing
Set TypeLib = Nothing

Last edited Feb 28, 2012 at 6:07 AM by pr3m, version 3


No comments yet.