Managing Duplicate Microsoft Systems Management Server Unique Identifiers

Technical Paper

Discusses methods for removing all duplicate unique identification numbers from SMS clients and servers.

On This Page

Introduction
Understanding Duplicate GUIDs
Removing Duplicate GUIDs from Your Configuration

Introduction

Systems Management Server (SMS) clients are uniquely identified by using Global Unique Identifiers (GUIDS) for SMS 2.0, or SMS Identifiers (SMSIDs) for SMS 1.2. If multiple clients have the same GUID or SMSID, then duplicate GUIDs or SMSIDs exist. Duplicate GUIDs or SMSIDs cause a variety of problems and can prevent an SMS site from functioning as designed. These problems can include corrupted inventory, advertisements going to the wrong clients, and impaired site server performance. This is because the GUID or SMSID is designed to uniquely identify computers to a variety of SMS processes. The practices that create duplicate GUIDs, such as creating images that contain SMS clients, are therefore unsupported. However, these practices can occur in a production environment unintentionally. This technical paper gives you a fundamental understanding of the problem and a variety of methods that you can employ to remove duplicate GUIDs from your configuration.

This technical paper is limited to discussing SMS 2.0. For information about how to remove duplicate SMSIDs from an SMS 1.2 site, see the Knowledge Base article "192859: SMS 1.2 SP4 Includes SMSIDDUP, DATDUPC, and DATDUPCL."

Understanding Duplicate GUIDs

A GUID is a Global Unique Identifier, which uniquely identifies SMS clients. It is created on SMS clients during client installation. A GUID is created by an algorithm that merges a timestamp and the output of a function called universally unique identifier (UUID) to create a statistically unique identifier. The exception to the use of this algorithm is when an SMS 1.2 client is upgraded to SMS 2.0. In this case, SMS 2.0 uses the SMS 1.2 SMSID of the computer as the GUID.

Location of the GUID

The GUID is stored in one registry location and in two files on an SMS client:

  • HKLM\Software\Microsoft\SMS\Client\Configuration\Client Properties\SMS Unique Identifier

  • %windir%\MS\SMS\core\data\SMSuid.dat

  • %windir%\SMScfg.ini

The GUID is stored in three tables in the SMS database:

  • System_DISC

  • System_DATA

  • System_HIST

Definition of a Duplicate GUID

A duplicate GUID is defined as that case where different computers have the same GUID. This is comparable to duplicate SMSIDs in SMS 1.2, where multiple computers had the same SMSID. This is not comparable to the duplicates displayed by the Dbclean utility in SMS 1.2, where single computers had multiple SMSIDs (often caused by deleting the SMS.ini on the computer).

A duplicate GUID is not the result of one computer that was reinstalled, therefore having had multiple GUIDs. Also, it is not the result of one computer whose name was changed but which is keeping the same GUID. These cases are allowed, and the data is properly handled by SMS.

A duplicate GUID results when different computers have the same GUID.

Causes of Duplicate GUIDs

Duplicate GUIDs are caused by:

  • Upgrading an SMS 1.2 site that has duplicate SMSIDs. See the Knowledge Base article "192859: SMS 1.2 SP4 Includes SMSIDDUP, DATDUPC, and DATDUPCL" for information regarding how to correct this problem on an SMS 1.2 site.

  • Using disk images that contain GUIDs (copying the GUID in the registry, SMSuid.dat, or SMScfg.ini from one computer to many computers).

  • SMS Installer repackaging during actual GUID creation. See the Knowledge Base article "183398: SMSINST: Duplicate SMS IDs Exist After a Package Is Deployed."

  • Special Case: Dual Boot configurations are supported in a limited manner, and appear as duplicate GUIDs. See the Knowledge Base article "199248 SMS: Limited Support for Dual Boot Clients."

Common Duplicate GUID Problems

The existence of duplicate GUIDs leads to the following common problems:

  • 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 as each of their discovery records is processed. For example, if computer A was discovered most recently, it appears in the All Systems collection. When computer B sends a discovery data record (DDR), it has the same GUID as computer A. When this discovery record is processed, computer A disappears from the All Systems collection and is replaced by computer B.

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

  • Advertisements can run on the wrong computer or not at all. In SMS 2.0 a "lookup file" is used to target advertisements. The lookup file targets given computers by using the GUID. Therefore, if computers have the same GUID, they can run advertisements not intended for them.

  • The SMS Executive (particularly the Inventory Data Loader component) can monopolize the CPU or use considerable amounts of memory or both. This is because of the large result set that is returned when querying for records associated with a particular GUID when that GUID is associated with multiple computers instead of a single computer. In one case, Inventory Data Loader rapidly consumed 600 MB of memory soon after Inventory Data Loader started. In another case, all available RAM was quickly utilized.

  • Note that it can be determined easily if Inventory Data Loader is the thread consuming RAM (or CPU utilization) by using the SMS Service Manager to stop Inventory Data Loader when this condition begins. If stopping Inventory Data Loader causes the memory to be released (or CPU utilization return to normal), duplicate GUIDs are the likely cause.

  • Windows NT Remote Client Installation does not install the SMS client. When Windows NT Remote Client Installation is enabled, Discovery Data Manager checks the client property of the computer associated with the GUID in the discovery data record that it is processing. If the client property in the database is "yes," Discovery Data Manager does not create a client configuration request (CCR) for that computer. Therefore, if the GUID is a duplicate, and a previous computer with the same GUID has successfully installed the SMS client, the client property in the database is "yes." All subsequent discovered computers that have the same GUID do not have CCRs created for them.

  • Excessive Inventory Resyncs can be generated. A Hardware Inventory Resync is initiated by Inventory Data Loader on the site server when a bad MIF file is discovered or when the Inventory Data Loader discovers that it is trying to process a MIF file that updates a non-existent row in the SMS site database. The latter case is common when two or more computers have the same GUID, because Inventory Data Loader attempts to update the database with inventory information from an entirely different computer.

Similar Problems Not Caused by Duplicate GUIDs

It is possible that you might have problems that are similar to the problems just described but that are not caused by duplicate GUIDs:

  • Multiple instances of the same computer might appear in collections when you view them in the SMS Administrator console. The only known cause of this condition has proven to be improper attempts to restore an SMS site server. Specifically, this cause involves attempting to back up the database while leaving the SMS services running.

  • Discovery properties of one computer are confounded with another computer, or incorrect names appear in the collection. This can be caused by a corrupt ARP cache giving improper result sets to Network Discovery, or similarly through inaccurate DNS reverse lookup tables. See the Knowledge Base article "244335 Network Discovery Causes Incorrect Names in Collections" for more information.

Duplicate GUIDs Are Not Supported

Sites that have multiple computers with the same GUID do not function correctly, and therefore Microsoft does not support this configuration. The design of all versions of SMS has relied on the ability to uniquely identify SMS clients by using this identifier. Duplicate GUIDs must be removed from both the clients and the database for the product to function as designed. This is stated in the Microsoft Systems Management Server Administrator's Guide Version 2.0 as follows:

  • "SMS 2.0 does not support the cloning of SMS client installations because each client must have a unique ID assigned during the installation phase. Cloning has been shown to cause inconsistent inventory and software distribution results."

Often duplicate GUIDs are introduced into an SMS site unintentionally and unknowingly. Therefore, Microsoft provides a variety of methods to remove duplicate GUIDs from your clients and SMS site database. In almost all cases, these methods result in a supported configuration. However, in rare and extreme cases it might be necessary to completely uninstall clients and/or remove all inventory data, or even reinstall the site to resolve the problem.

Removing Duplicate GUIDs from Your Configuration

To successfully remove duplicate GUIDs from your configuration you must plan carefully. Because the GUID is stored on the client and in the SMS site database, and because it is the basis on which advertisements are targeted, you must coordinate how and when you remove the duplicate GUID from each location. For example, if you choose to remove the GUID from the clients using a recurring software distribution package, do not remove the duplicates from the SMS site database before your advertisement runs. This is because the target for that advertisement is a collection that is based on those same duplicate GUIDs.

Typically, you remove the duplicate GUIDs from the clients first. After the duplicates are completely removed from the clients and all clients have a unique GUID, the database can then be addressed. In the case where the site server is severely impacted by duplicate GUIDs that create excessive memory or processor utilization, you might need to address the SMS site database first. If you have a large number of duplicates, you might use a logon script solution for the clients, because you have already removed the duplicate GUIDs from the database. Alternately, you could create a report of the computers that have duplicate GUIDs, then remove the duplicates from the database as often as necessary. (They continue to cause problems at each inventory cycle until the GUID is changed on the client itself). You could then remove the duplicate GUID manually from the client computers that are identified in the report.

Because each environment is unique, and has unique constraints, you must come up with a plan consisting of a combination of the methods presented in the next section.

Removing Duplicate GUIDs from SMS Clients

It is necessary to allocate a new GUID on all SMS clients where the GUID has been duplicated. Merely uninstalling the client (for example, by running 20clicln.bat) is insufficient to accomplish this, because the GUID remains even when the client is removed. Also, you must not attempt to manually change the GUID on an active client because the GUID is used for additional functions, and you might orphan or corrupt your client.

There are two methods you can use to change a GUID. You can uninstall the SMS client, remove the stored GUID on the client, and then reinstall the SMS client software. Or, you can run the SMS Resource Guide utility Newuid.exe /s /allocate through the logon script, through an advertisement, or by sending a technician to run it manually. You can modify Newuid.exe and customize it for your specific needs. The SMS Installer Script from which it is compiled is included in the SMS Resource Guide.

In order to allocate new GUIDs on all affected computers in your environment, you might have to use a combination of running Newuid.exe through logon scripts, advertisements, and manual methods. Most likely you will have to use a combination of methods because not all computers use logon scripts and not all sites participate in software distribution.

Removing Duplicate GUIDs from SMS Clients Without Newuid.exe

In all cases be sure to follow all the steps outlined. Partially removing a GUID can cause the SMS client to be unstable. The steps are:

  1. Identify which clients have duplicate GUIDs, using either the WQL or Transact SQL (TSQL) queries

  2. Uninstall the client by using SMSMan /u or 20clicln.bat.

  3. Delete three instances of GUID:

    HKLM\Software\Microsoft\SMS\Client\Configuration\Client Properties\SMS Unique Identifier

    %windir%\MS\SMS\core\data\SMSuid.dat

    %windir%\SMScfg.ini

  4. Reinstall the SMS Client by running SMSls.bat or SMSman.exe.

For more information, review Knowledge Base article "262657: SMS: Client Deinstall Methods Do Not Remove All Installed Items."

Removing Duplicate GUIDs from SMS Clients with Newuid.exe

You can use the following details to remove GUIDs by using the Newuid.exe program included in the Systems Management Server 2.0 Resource Guide (available from book retailers – International Standard Book Number 0-7356-0928-4).

Newuid.exe /s /allocate – the Importance of the Switches

In all cases Newuid.exe should be run with the /s /allocate switches. When you run Newuid.exe, use the Newuid.exe /s /allocate command to allow the clients to obtain a new ID and retain client functionality. The /s switch causes the process to run silently.

Note: You do not receive confirmation that the clients have successfully run the program if you do not use the /allocate switch. After Newuid.exe is run without the /allocate switch, all client communication with the client access point (CAP) stops until the client either runs SMSls.bat or SMSman.exe, or is reinstalled by using the Windows NT Remote Client Installation method. Client functionality does not return, and the new ID is not allocated, until the client uses one of these installation methods.

Removing Duplicate GUIDs from SMS Clients Using Logon Scripts and Newuid.exe

If a large percentage of your clients have duplicate GUIDs, it might be easier to change the GUID of all clients by using logon scripts and Newuid.exe. You can use this method to configure your client logon scripts in such a way that Newuid.exe is run one time only on all existing clients and then on every new client that logs on thereafter. The logon script copies Newuid.exe to the local computer if it is not already present. Then, if the computer has never been "tagged" previously, it runs a local copy of Newuid.exe.

Note: If an image is created with this tag file, this method still changes the GUID on any computers created from that image because the computer name is included in the tag file name. Also, if you have outstanding software advertisements, this method can cause the clients to not receive them because their GUIDs have changed. Subsequent advertisements targeting computers with the new GUID should be successful.

To use logon scripts to remove duplicate GUIDs from SMS clients

  1. Replicate both the Newuid.exe program and a tag file that contains a datetime stamp (for tracking purposes) to all logon server shares.

  2. Edit your user logon scripts to either of the following solutions, to be called prior to SMSls.bat:

  • For environments with clients running Windows 95 or Windows 98:
REM  Use this script if you have Windows 95 or Windows 98 clients
REM  Note that this will cycle all GUIDs once, then any computer without
REM  the sms1.tag file.  If an sms1.tag file appears in your images
REM  this script will not clean them without changing this file to sms2.tag, 
REM which will cause ALL GUIDs to cycle again
If exist %sms_local_dir%\ms\sms\core\data\sms1.tag goto DONE
If exist %sms_local_dir%\ms\sms\core\bin\newuid.exe goto RUN_IT
REM load Newuid.exe from the netlogon share
copy %0\..\newuid.exe %sms_local_dir%\ms\sms\core\bin
If not exist %sms_local_dir%\ms\sms\core\bin\newuid.exe goto FAIL_IT
:RUN_IT
%sms_local_dir%\ms\sms\core\bin\newuid.exe /s /allocate
date /t>%sms_local_dir%\ms\sms\core\data\sms1.tag
:DONE
cls
exit
:FAIL_IT
echo Failed to find Newuid.exe locally, exiting>%sms_local_dir%\ms\sms\core\data\newuid.log 
date /t>>%sms_local_dir%\ms\sms\core\data\newuid.log
cls
exit
  • For environments with clients running Windows NT or Windows 2000 only.

Note: You can also use this solution on your clients that are running Windows 95 or Windows 98 if you modify Newuid.ipf to add the environment variable %computername%. This solution is preferred, because the tag file name %computername% tag cannot be imaged.

REM  Warning, this will cycle all GUIDs once!  Also, this does not work for 
REM  Win9x clients unless the %computername% environment variable is added.
If exist %sms_local_dir%\ms\sms\core\data\%computername%.tag goto DONE
If exist %sms_local_dir%\ms\sms\core\bin\newuid.exe goto RUN_IT
REM load Newuid.exe from the netlogon share
copy %0\..\newuid.exe %sms_local_dir%\ms\sms\core\bin
If not exist %sms_local_dir%\ms\sms\core\bin\newuid.exe goto FAIL_IT
:RUN_IT
%sms_local_dir%\ms\sms\core\bin\newuid.exe /s /allocate
date /t>%sms_local_dir%\ms\sms\core\data\%computername%.tag
:DONE
cls
exit
:FAIL_IT
echo Failed to find Newuid.exe locally, exiting>%sms_local_dir%\ms\sms\core\data\newuid.log 
date /t>>%sms_local_dir%\ms\sms\core\data\newuid.log
cls
exit

Removing Duplicate GUIDs Using Software Distribution and Newuid.exe

You can use this method to run Newuid.exe with the /s /allocate switch as a software distribution periodically, or through a collection rule that targets specific client computers. This method runs on most of your computers over time. However, because duplicate GUIDs can cause mistargeted software distributions, you might need to run the advertisements several times before all computers run the advertisement. This method can be helpful in removing duplicate GUIDs from computers, such as servers, that do not run logon scripts.

Warning: If you copy Newuid.exe to the clients and then have your SMS advertisement run the program from there, you could encounter the problem described in Microsoft Knowledge Base article 235149. That article explains that SMS does not properly run advertisements that include command lines which include spaces when the program to be run is stored locally on the computer. Newuid.exe should always be run with the /s and /allocate command-line switches. Do not put spaces between the program name and those switches. To be sure that you avoid this problem, you might consider putting the Newuid /s /allocate command in a batch file, and have the advertisement execute the batch file. Note that this problem does not apply to you if you run Newuid.exe from an SMS distribution point, as is typically done with SMS packages.

To use advertisements to remove duplicate GUIDs from SMS clients

  1. Create a package and program calling a batch file that runs Newuid.exe with the /s /allocate switch. Be aware of Knowledge Base article "235136 SMS: Command Fails When Running an Advertisement Using %windir%" and "235149 Simple Command Fails in Available Program Manager (APM)."

  2. Create a collection with six membership rules using the following six WQL queries. Be aware of Knowledge Base articles "188053 SMS: How to Use Writeqdf.exe from the BackOffice Resource Kit" and "235192 SMS: Using a carriage return in the 'where' clause in a Collection." These queries check the Discovery, Data, and History tables for duplicates.

Collection Query 1 (Duplicates - DISC and HIST):

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.
SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client 
from SMS_R_System join SMS_GH_System_System on SMS_R_System.ResourceID =
 SMS_GH_System_System.ResourceID where
 SMS_R_System.Name <> SMS_GH_System_System.Name

Collection Query 2 (Duplicates - DISC and INV):

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.
SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client 
from SMS_R_System join SMS_G_System_System on SMS_R_System.ResourceID 
= SMS_G_System_System.ResourceID where
 SMS_R_System.Name <> SMS_G_System_System.Name

Collection Query 3 (Duplicates - HIST and DISC):

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.
SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client 
from SMS_R_System where SMS_R_System.Name in 
(select SMS_GH_System_System.Name from SMS_R_System join
 SMS_GH_System_System on SMS_R_System.ResourceID = SMS_GH_System_System.ResourceID where
 SMS_R_System.Name <> SMS_GH_System_System.Name)

Collection Query 4 (Duplicates - INV and DISC):

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.
SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client 
from SMS_R_System where SMS_R_System.Name in (select SMS_G_System_System.Name from 
SMS_R_System join SMS_G_System_System on SMS_R_System.ResourceID =
 SMS_G_System_System.ResourceID where
 SMS_R_System.Name <> SMS_G_System_System.Name)

Collection Query 5 (Duplicates - INV and HIST):

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.
SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client from
 SMS_R_System where SMS_R_System.Name in (select SMS_G_System_System.Name from 
SMS_G_System_System join SMS_GH_System_System on SMS_G_System_System.ResourceID =
 SMS_GH_System_System.ResourceID where
 SMS_G_System_System.Name <> SMS_GH_System_System.Name)

Collection Query 6 (Duplicates - HIST and INV):

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.
SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client 
from SMS_R_System where SMS_R_System.Name in (select SMS_GH_System_System.Name from 
SMS_G_System_System join SMS_GH_System_System on SMS_G_System_System.ResourceID =
 SMS_GH_System_System.ResourceID where
 SMS_G_System_System.Name <> SMS_GH_System_System.Name)

Removing Duplicate GUIDs Manually Using Newuid.exe and a Duplicates Report

For client computers that cannot run Newuid.exe in a logon script or through an advertisement, you must change the GUID manually. You can use database queries to identify these computers and then run Newuid.exe with the /s /allocate switch on each reported computer.

Identify the computers that have duplicate GUIDs using either the following three WMI WQL queries or the single TSQL query. When interpreting the results of these queries, pay particular attention to those cases in which there are many computers with the same GUID. These computers are likely the result of an imaging process, with the oldest SMS client on this list being the imaged computer. For those cases in which there are only two clients listed with the same GUID, it is likely that this is really only a computer name change or that the system uses a dual boot configuration. If this is the case, it is not necessary to run Newuid.exe on those specific computers. However, doing so does not negatively impact the system other than creating a new GUID. The method chosen to identify duplicate GUIDs (SMSUniqueIdentifiers or SMSIDs) in these queries is to look for computer name differences. Computers with duplicate GUIDs have different names. Legitimate computer name changes are also identified.

Note: Because collections must use certain properties from the discovery table in WQL format, neither of these queries can be used as the basis of a collection.

WQL Query Identifying Computers with Duplicate GUIDs

The following WQL queries must be created as three separate queries due to limitations of unions in WQL. If you cut and paste these queries into the Query Statement Properties, be sure not to include carriage returns, because they cause the query to not function.

Query 1

select distinct g.Name, g.SMSID, r.Name, r.SMSUniqueidentifier from SMS_G_System_System as
 g join SMS_R_System as r on g.ResourceID=r.ResourceID where g.Name <> r.Name

Query 2

select distinct g.Name, g.SMSID, h.Name, h.SMSID from SMS_G_System_System as g join
 SMS_GH_System_System as h on g.ResourceID=h.ResourceID where g.Name <> h.Name

Query 3

select distinct r.Name, r.SMSUniqueidentifier, h.Name, h.SMSID from SMS_R_System as r join
 SMS_GH_System_System as h on r.ResourceID=h.ResourceID where r.Name <> h.Name

TSQL Query Identifying Computers with Duplicate GUIDs

TSQL queries cannot be used in a query object in the SMS Administrator console. TSQL queries should be run using usual SQL Server query tools, such as Query Analyzer, or a scheduled SQL Server command in the SMS Administrator console under the Site Settings, Database Maintenance section of the SMS Administrator console tree.

SELECT  
g.SMSID0 AS "Duplicate GUID", g.Name0 AS "Computer A", 
g.Domain0 AS "Domain A", r.Name0 AS "Computer B", 
r.Resource_Domain_OR_Workgr0 AS "Domain B", 
r.User_Name0 AS "User Name from Discovery" 
FROM System_DATA AS g
JOIN System_DISC AS r ON g.MachineID=r.ItemKey
WHERE g.Name0 <> r.Name0
UNION
SELECT 
g.SMSID0, g.Name0, g.Domain0, h.Name0,
h.Domain0, "" 
FROM System_DATA AS g
JOIN System_HIST AS h ON g.MachineID=h.MachineID
WHERE g.Name0 <> h.Name0
UNION 
SELECT 
g.SMSID0, r.Name0, g.Domain0, g.Name0, 
r.Resource_Domain_OR_Workgr0, r.User_Name0 
FROM System_DISC AS r
JOIN System_HIST AS g ON r.ItemKey=g.MachineID
WHERE r.Name0 <> g.Name0
ORDER BY g.SMSID0

Using the Results of the Queries

When you have run the queries to produce a report of computers with duplicate GUIDs, you can use either of the following methods to remove the duplicate GUIDs from the clients:

  • Dispatch a technician to run Newuid.exe with the /s /allocate switches on each computer, or consider sending a link in e-mail to each user to run Newuid.exe /s /allocate.

  • For computers, such as servers, from which you must remove the GUID remotely, you can manually delete the GUID. However, you must also remotely run SMSls.bat or SMSman.exe on the server to avoid orphaning the client. To delete the GUID, remove:

  • The GUID value in "SMS Unique Identifier" from the registry in HKLM\Software\Microsoft\SMS\Client\Configuration\Client Properties

  • The value for "SMS Unique ID=" in the %windir%\SMScfg.ini (leave "SMS Unique ID=", merely delete the GUID).

  • If it exists, the value for "MS Unique Identifier=" in the %SMSROOT%\Core\Data\SMS1x.ini (leave the "MS Unique Identifier=", merely delete the GUID).

  • The file %windir%\MS\SMS\CORE\DATA\SMSuid.dat

After removing the duplicate GUIDs, you should continue to run the query to ensure that new imaged GUIDs are quickly identified.

Removing Duplicate GUIDs from the SMS Site Database

In addition to changing the GUIDs on SMS clients, you must also remove all records associated with a duplicate GUID in the database. You should not remove the duplicates from the database before you clean up the clients if you are using SMS software distribution to deliver Newuid.exe (unless the site server is severely affected). So be sure to clean up your clients first.

Note that the methods presented here are an improvement over, and are to be considered a replacement for, the methods published in the Systems Management Server Administrator's Guide, and in the earlier versions of the Knowledge Base article "254735 How to Clean Up Duplicate Computer Ids."

There are three alternate methods to remove duplicate GUIDs from your SMS site database. These methods clean more thoroughly than the previous methods, and they do not require you to delete your inventory history. The three methods are:

  • TSQL Method – run as an automated SQL Server task. This method can be entirely automated.

  • WQL Method – run as a delete special against a collection.

  • Direct Membership Rule Method – run as a delete special against a collection.

Warning: You should understand that because the GUID is, by design, the unique identifier for SMS clients, any method to clean up duplicate records where this uniqueness has been compromised results in a less than an ideal solution. The TSQL and WQL methods rely on finding all computers with the same GUID and different computer names. This means that these queries also identify any computer that has had a computer name change or has a multiple boot configuration. If preserving the data for these systems is important to you, do not delete duplicates based on either of the first two solutions. Rather, use the third solution, and create a direct membership collection based only on the GUID where you have verified that the GUID has been duplicated.

Note: It is important for you to realize that if you use the TSQL or WQL methods, you will delete data from computers whose GUID was not duplicated, but whose names only were changed.

Method 1: Transact SQL Method

To use the Transact SQL (TSQL) method

  1. Run the TSQL query from the earlier section "TSQL Query Identifying Computers with Duplicate GUIDs." You should keep the report from this query and use it to ensure the computers identified have had their GUIDs reallocated.

  2. Clean up the clients identified in Step 1. Ensure that you have allowed adequate time for any advertisements running Newuid.exe to run, if you have chosen this method.

  3. Run the following TSQL script regularly to delete the data associated with the affected computers. This can be automated as a regular task in the Database Maintenance, SQL Commands option in the SMS Administrator console.

  4. Note that this is a TSQL query, and it cannot be used to create a query or collection in the SMS Administrator console.

create table #dups
(
  ItemKey int
)
insert into #dups(ItemKey) 
 select sd.ItemKey
   from System_DISC as sd
   join System_DATA as d on sd.ItemKey=d.MachineID
     where sd.Name0<>d.Name0
union
 select sd.ItemKey
   from System_DISC as sd
   join System_HIST as h
   on sd.ItemKey=h.MachineID
     where sd.Name0<>h.Name0
union
 select d.MachineID
   from System_DATA as d
   join System_HIST as h
     on d.MachineID=h.MachineID
     where d.Name0<>h.Name0
-- needed to propagate deletes to subsites --
insert into DeletedItems(ItemKey,SiteCode)
  select #dups.ItemKey, assgn.SMS_Assigned_Sites0 from #dups
  join System_SMS_Assign_ARR as assgn on #dups.ItemKey=assgn.ItemKey
-- used to revoke liscenses from software metering -- 
insert into DeletedMachines(SMSID)
  select sd.SMS_Unique_Identifier0 
   from System_DISC as sd
   join #dups on sd.ItemKey=#dups.ItemKey
     where sd.SMS_Unique_Identifier0 is not NULL
delete sd from System_DISC sd
  join #dups on sd.ItemKey=#dups.ItemKey
drop table #dups

Method 2: WQL Method

To use the WQL method

  1. Run the WQL query specified for clients in the earlier section "WQL Query Identifying Computers with Duplicate GUIDs" to create a report of computers that must be cleaned up. Note that this query cannot be used as the basis of a collection.

  2. Clean up the clients identified in Step 1. Ensure that you have allowed adequate time for any logon scripts or advertisements running Newuid.exe to run, if you have chosen either of these methods.

  3. Right-click the collection created for clients in the earlier section "Removing duplicate GUIDs Using Software Distribution and Newuid.exe" and click Delete special. This step should be done on a regular basis. (Depending on the number of duplicates in your system, this may need to be done frequently at first).

  4. Note You may need to wait for an SMS Collection Evaluator cycle to be completed before seeing any members of this collection. Also, this collection might not have a rowcount equal to the number of computers detected by the TSQL query.

Method 3: Direct Membership Collection Method

If you have only a few GUIDs that are duplicated, or if you must preserve all computers that have changed computer names and do not have duplicate GUIDs, it might be easier to create a direct membership rule collection based on the GUID.

To use the Direct Membership Collection method

  1. Identify the GUIDs that are duplicated using the TSQL script specified for clients in the earlier section "TSQL Query Identifying Computers with Duplicate GUIDs." (The section also contains instructions about how to interpret the results of this query.)

  2. In the SMS Administrator console, right-click Collections, and then click New.

  3. In the Collection Properties dialog box, name your new collection Duplicates.

  4. On the Membership Rules tab click the computer icon.

  5. For Resource Class, click System Resource. For Attribute Name, click SMS Unique Identifier.

  6. Specify the unique identifier (GUID) that was imaged. Specify the collection as All Systems.

  7. Right-click your Duplicates collection, and run Delete special.

Creating a Unified Solution: A Sample Plan

Each SMS environment is unique and has its own unique requirements and caveats. Therefore, you must give some thought to exactly what combination of methods you want to use to handle duplicate GUIDs in your configuration. The following is a sample plan that provides a unified solution for a fictional company.

Anytime:

  • An alert is generated when an SMS site server's SMS Executive experiences high memory or CPU utilization.

  • The operations group immediately pages the SMS team lead and notifies the monitoring center that they will possibly be stopping and starting the SMS Executive on that computer.

  • The operations group follows the procedure in the "Common Duplicate GUID Problems" section of this technical paper and reports the results to the SMS team lead.

  • The SMS team lead runs the query "TSQL Query Identifying Computers with Duplicate GUIDs" to verify that duplicate GUIDs are the problem, identifies the image source, and opens a change ticket to have the source cleaned of the GUID.

  • The SMS team lead runs the query from the "Transact SQL Method" section of this technical paper and verifies that this resolved the high memory and/or CPU utilization.

Daily:

  • 6AM - The automated task runs the query discussed in the "TSQL Query Identifying Computers with Duplicate GUIDs" section of this technical paper.

  • 7AM – The operations group reviews the "TSQL Query Identifying Computers with Duplicate GUIDs" report. They immediately open a change ticket if a new image is identified. They do this to find and clean the image, and they open change tickets to have a technician run the "Removing Duplicate GUIDs Manually Using Newuid.exe and a Duplicates Report" solution on any computers that are identified as having duplicate GUIDs that do not run a logon script and are excluded from Software Distribution.

  • 7:30AM - Recurring Advertisement runs based on "Removing duplicate GUIDs Using Software Distribution and Newuid.exe" solution.

  • 8:00AM – 10:00AM Login script runs, running Newuid.exe if necessary.

Weekly:

  • Sunday 2:00PM – The automated task runs from the SQL query, discussed in the "Transact SQL Solution" section of this technical paper, to delete any clones from the database.

  • Monday 6:45 AM – The operations group verifies that the automated task running the SQL query in the "Transact SQL Solution" section of this technical paper ran correctly.

Note: the duplicates report includes identifiers in the old SMS 1.2 SMSID format, it is possible an SMS 1.2 child site is attached to the hierarchy with duplicates. See the Knowledge Base article "192859: SMS 1.2 SP4 Includes SMSIDDUP, DATDUPC, and DATDUPCL" for more information.