Friday 8 January 2010

How to delete a duplicate Computer entry on SCCM the database

To delete a duplicate Computer entry on SCCM the database

!!!!only when you cannot find the duplicate within the sccm console itself!!!!
Make sure the DB has been backed up before you continue

The example below looks for a duplicate called PCNAME and removes the non valid entry.

select name0 , count (*) from v_r_system GROUP BY name0 having count (*) > 1;.
Should show duplicates

select * from v_R_System where Name0 = 'PCNAME'
Should show duplicates and more details. You now choose which duplicate to remove ( in this case Resource ID 12989 because Active0 is NULL)

delete from v_R_System where ResourceID = 12989
Deletes the choosen entry

Use ALT-X to execute single lines in a query

2 comments:

  1. Worked for us :) Took forever finding that database view out of the 1000's! Thanks!

    ReplyDelete
  2. This query list duplicates where R.Client is NULL. We use is to remove duplicates from our SCCM 2007 system

    select R.ResourceID,R.ResourceType,R.Name,R.SMSUniqueIdentifier,R.ResourceDomainORWorkgroup,R.Client from SMS_R_System as r full join SMS_R_System as s1 on s1.ResourceId = r.ResourceId full join SMS_R_System as s2 on s2.Name = s1.Name where s1.Name = s2.Name and s1.ResourceId != s2.ResourceId and R.Client is null

    ReplyDelete