Duplicate GUIDs? – Fix it with Scripts!

You may have figured out that having duplicate SMS Unique ID’s (a.k.a. Duplicate Guids) in SMS can cause problems.

Per KB837374 you may experience the following symptoms:

• The SMS Administrator console displays only the last discovered client of those clients that share a GUID. If many different computers have the same GUID, they replace each other in the collections. This is because each of their discovery records is processed.

• Advertisements can run on the wrong computer or not at all.

• When inventory records (MIFs) from computers that have the same GUID are processed, the inventory properties of the computers can be merged.

• The SMS Executive, specifically the Inventory Data Loader component, can monopolize the CPU, can use lots of memory, or both. This is because of the large result set that is returned when querying for records associated with a particular GUID. Inventory Data Loader consumes large amounts of RAM. If stopping Inventory Data Loader causes the memory to be released, or if CPU utilization returns to normal, duplicate GUIDs are the likely cause.

• SMS Client Push Installation does not install the SMS client.

• Excessive Inventory Resyncs can be generated. Duplicate SMSIDs are frequently referred to as "duplicate GUIDs."

The following scripts can be used to find the problem computers, run the tranguid.exe utility from the SMS 2003 Toolkit (to create a new Guid), then restart the SMS Agent Host on the client.

Use SQL Query to Find Problem Computers

The following SQL query will give you a list of computers that have been discovered but do not have a GUID. This is usually because the client is not installed or another computer on the network has the same SMS GUID.

Select Netbios_Name0 from System_Disc where SMS_Unique_Identifier0 = NULL

Save the results of this file off to a text file named DuplicateGuids.txt

Create the Script to Run the Tranguid.exe Utility Once on the Problem Computers

‘miory 11/06/2007
‘The following script checks to see if the computer that this is run on is in the DuplicateGuids.txt file AND ‘has a c:\windows\smscfg.ini file (which is what we will use to determine if it has the SMS Client). If it ‘does then we will see if it has already run this utility by checking for a flag file: c:\tranguid\tranguid.txt ‘If we do not see this file, we will assume this has not run yet. After we run the utility we will create the ‘file so that this utility does not run again.

Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oComputerSystem = oWMI.ExecQuery("Select Name from Win32_ComputerSystem")
For Each oInstance in oComputerSystem
oName = oInstance.name
Next
Set WshShell = WScript.CreateObject("WScript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim arrFileLines()
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("\\MyServer\MyShare\SMS Tools\DuplicateGuids.txt", 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
If UCase(arrFileLines(l)) = oName Then
If filesys.FileExists("c:\Windows\smscfg.ini") Then
CreateFlagFolder
End If
End If
Next
Sub CreateFlagFolder
If filesys.FolderExists("c:\TranGuid") Then
CreateFlagFile
Else
Set folder = filesys.CreateFolder("c:\TranGuid")
CreateFlagFile
End If
End Sub
Sub CreateFlagFile
If NOT (filesys.FileExists("c:\TranGuid\TranGuid.txt")) Then
WSHShell.Run "TranGuid.bat"
Set filetxt = filesys.CreateTextFile("c:\TranGuid\TranGuid.txt", True)
End If
End Sub

Save this file as TranGuid.vbs

Create the Batch File to Run Tranguid.exe and Restart the SMS Agent Host Service

REM This batch file assumes that you have the SMS 2003 Toolkit
REM Installed on all client machines. If you do not, you must copy the tranguid.exe from the
REM toolkit to an accessible network location and modify this batch file appropriately
cd "C:\Program Files\SMS 2003 Toolkit 2"
TranGuid.exe /r
net stop ccmexec
net start ccmexec

Save this file as TranGuid.bat in the same network directory as TranGuid.vbs and TranGuid.exe

Modify Your Login Script

Once you have created your text file, script file, and batch file, you are ready to implement your solution.

Modify your login script to run the TranGuid.vbs script and your environment should start going back to normal.

*Note - The most common cause of duplicate guids is that a computer, that has the SMS Client installed, is used as a master computer for imaging. If you must image the SMS Client, please follow the steps in KB828367 to prevent this issue from happening.

Hope this helps!

Mike Ory