2 Replies Latest reply on Aug 10, 2017 2:03 PM by Codys26

    How can I clean up MachineGroups/Machines via SQL?

    Codys26 Rookie



      As part of our cleanup efforts, we found a bunch of entries in the ManagedGroups table that do not show up in the Console.  I found that all of these MachineGroups have a '1' in the grpTemp column (no others do).  As you can see some groups were last updated in 2008-2014

      Here is the SQL query I used:


      SELECT grpID







      FROM ManagedGroups

      WHERE grpTemp='1'

      ORDER BY grpUpdateDate


      Here is my output:


      Looking at the first one on the list, I queried the DiscoveryFilter table to find the members of the group


      SELECT mg.grpName AS MachineGroup,df.name AS MachineName

           FROM DiscoveryFilter AS df

           JOIN ManagedGroups mg

                ON df.discoveryGroupId = mg.grpID

           WHERE grpName ='dcc5b4af1f8b4b8284e0a0ad54308af2'


      Here is my output (A machine name that has been decommed for several years)



      Also, if I search the DiscoveryFilter table for that machine name,


      SELECT * FROM DiscoveryFilter

           WHERE name='XXXXXX'


      I get:



      Is there a safe way to clean this up?  Should I be fine if I delete from both of these tables after I perform a backup?