Close Menu
    Facebook X (Twitter) Instagram
    Sunday, October 12
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CM2012»sccm Configmgr 2012 Delete duplicate Obsolete records etc using collections

    sccm Configmgr 2012 Delete duplicate Obsolete records etc using collections

    Eswar KonetiBy Eswar KonetiMarch 24, 2:20 pm3 Mins Read CM2012 13,400 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Few days back,I was working on Client health remediation issues.for this activity,I created some cool SSRS reports based on client health statistics,you can find them on the below link:  http://eskonr.com/2014/05/sccm-configmgr-2012-ssrs-dashboard-client-health-summary-report/

    With above report,found that ,Count of missing clients very few hundred which is 2% from total --not bad  but still need to install the client on missing computers using different client installation methods like client push,logon script etc . Since i have few hundred computers,i would prefer to go with client push installation using clientpushgenerator tool.

    while troubleshooting the client installation ,I found many clients appearing twice --duplicate records,obsolete ,One computer having multiple resource IDs.More you can refer the link  http://social.technet.microsoft.com/Forums/systemcenter/en-US/8f3fd7cd-0e3d-4429-bcde-02b2ec77324d/report-showing-servers-showing-two-os?forum=configmgrgeneral#ac775d37-141a-404c-a345-7d882b1bbe17

    All these duplicate ,obsolete issues are addressed in multiple blogs---- how to create collection to find duplicate records and delete them from database ,So  I thought of presenting all in one blog including new issue—One computer with different Resource IDs.

    How did i trace this out ?

    I ran below SQL query on SSMS (management Studio) --the below query basically tells ,get computer names with count more than 2 .I Found many entries .I pick one computer and ran select * from v_r_system where name0=’computer name’ This query gave me  2 entries for one computer name,both the entries show as active,No Obsolete,Client is 1 .I really stumbled on up by seeing this results as all the entries are same .what else I can check to differentiate between these entries ?

    select sys.name0

    from v_r_system sys
    group by  sys.name0
    having count(sys.name0) >=2

    I gave up finding a way to cleanup only the duplicate entries and decided to cleanup both the entries so clients which are online will send  DDR  back to Site,which will get update in Database as simple as that.

    Below are collections what you need to have in place to cleanup the duplicate/obsolete /computers not contacted domain( use atribute LastLogontimestamp) during X days which means they are no more on the network and no hardware inventory for 30 days.

    Duplicate Computer Names:

    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 = null

    Duplicate Resource ID with same Computer Name(based on Active Status):

    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.Active is null  and SMS_R_System.Name in (select Name  from  SMS_R_System where SMS_R_System.Active = "1")

    Obsolete Computers:

    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.Obsolete = "1" and SMS_R_System.Name not like "Unknown"

     Computers not contacted Domain during 90 days and Hardware Inventory is more than 30 days old:

    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 inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_R_System.ResourceId in (select SMS_R_System.ResourceID from SMS_R_System inner join SMS_G_System_WORKSTATION_STATUS on SMS_G_System_WORKSTATION_STATUS.ResourceID = SMS_R_System.ResourceId where DATEDIFF(dd,SMS_G_System_WORKSTATION_STATUS.LastHardwareScan,GetDate()) > 30 and DATEDIFF(dd,SMS_R_System.LastLogonTimestamp,GetDate()) > 90) and SMS_R_System.LastLogonTimestamp is not null  and SMS_G_System_OPERATING_SYSTEM.Caption not like "%server%"

    You can either manually delete the entries from collection or create schedule job which performs deletion of resources at regular intervals .

    cleanup cleanup duplicate computers Collection configmgr Duplicate Computers collection duplicate records lastlogontimestamp obsolete collection SCCM SCCM 2012
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    Optimize Your Intune Workflow with a Powerful Browser Extension

    March 22, 10:39 am

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    16 Comments

    1. Siddharth on February 28, 2017 3:07 PM

      Hello Eswar ,

      Thanks for information shared, i have one question .Regarding collection "Duplicate Resource ID with same Computer Name(based on Active Status)" i can see lot of systems in collection but none of them has same resourceid or name .
      Can you please assist on this .Thanks in adv.

      Regards
      Siddarth

      Reply
      • Eswar Koneti on March 10, 2017 2:51 PM

        Lot of system in collection without same host name ? if not same host name, why does it bother you ? if you have same host name for some reason and other fields like active ,obsolete etc are same for these host names ,you may have to go with their last contact date to server name to identify which is not contacted recently for deletion.

        Regards,
        Eswar

        Reply
    2. Shrividya on September 4, 2015 7:24 PM

      Hi Eswar,

      We are going to deploy new image through SCCM2012 R2 to all the workstations

      Once image is installed, It will rename the PC as per the new standards.

      How to query the old names and the respective new name of the PCs.

      Also how to delete only Old PCs..

      Please help me.

      Thanks in advance.

      Reply
      • Eswar Koneti on September 12, 2015 10:57 AM

        I would suggest to add a registry key in the task sequence to add the Image installation date so you can query this reg key using SCCM to confirm which is old image and which is newly imaged .If you have followed the naming convention for your old image installed PC's ,you can try creating collection with that.

        Regards,
        Eswar

        Reply
    3. Divya on August 25, 2015 7:10 PM

      None of the Queries mentiuoned above are working for me (SCCM2012) .. Is there anything Im missing ?

      Reply
      • Eswar Koneti on August 26, 2015 8:41 AM

        what query not working for you ? did you check the syntax errors any ?

        Reply
        • Brachus on April 26, 2017 8:16 PM

          HOW does one check for syntax errors? Cut and pasting queries from website ALWAYS fails and the SCCM wizard just complains that the query is wrong instead of telling WHAT exactly is wrong

          Reply
          • Eswar Koneti on May 1, 2017 4:32 PM

            when you copy the code from internet, quotes replace with fancy quotes ,so you will have to replace the quotes manually before using it.

            Regards,
            Eswar

            Reply
    4. Malabica on April 23, 2015 6:09 PM

      Not sure whether this is the correct forum to discuss this topic or not but I have deployed Microsoft Office Update Patches and on 4 computers it says Non-compliant. Could you please clarify whether it means that the MS update is not required to be installed on the computers therefore it says non compliant or there is something else which should be checked and resolved.

      Reply
      • Eswar Koneti on April 24, 2015 8:17 AM

        Non-Compliant is, patches are required -->software update is applicable but is not yet installed.Alternatively, it may mean that the software update was installed but the state message has not yet been sent to to the site server.More information and how to troubleshoot,please refer this post http://eskonr.com/2015/04/sccm-2012-troubleshoot-client-software-update-issues/

        Reply
    5. Dean on September 19, 2014 11:40 AM

      Awesome stuff
      but please tell me in your last sentance you state
      "You can either manually delete the entries from collection or create schedule job which performs deletion of resources at regular intervals "

      how will i go about automating the removing of machines in those collections.

      Reply
      • Eswar Koneti on September 19, 2014 1:37 PM

        i illustrated that here http://eskonr.com/2014/08/sccm-configmgr-2012-powershell-script-cleanup-duplicate-obsolete-and-outdated-computers-via-scheduled-tasks/

        Reply
    6. SARITHA on March 28, 2014 5:21 PM

      Hi,
      After pressing F8, iam able to ping DHCP and SCCM Server.

      Regards,
      Saritha

      Reply
      • Eswar Koneti on March 28, 2014 9:59 PM

        on the same window,can you look for smsts.log ? from X:\windows\temp\smsts folder ? to see what is going init ?

        Reply
    7. saritha on March 27, 2014 7:13 PM

      Hi,

      I have a SCCM 2012 as hyper-v virtual machine in windows server 2008 r2 to deploy and capture a Windows 8.

      When starting the client, From PXE it downloads Boot.wim and it starts loading the files, says it is initializing the hardware (it detects the network card), then initializing the network connections. and then, the computer reboots!

      Please help

      Regards,
      saritha

      Reply
      • Eswar Koneti on March 28, 2014 2:41 PM

        Suspect it could be nic driver issues. When you are on pxe, can you press f8 and check for the ipaddress.

        Reply

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2025 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.