Why do I see more agents when I run a Query then I do when I create a Dynamic Group based on that Query ?

Document ID : KB000044485
Last Modified Date : 14/02/2018
Show Technical Document Details

Introduction: 

     In CA Client Automation you can create Queries and then create Groups and base them off those Queries.

     The numbers of agents should be the same, but since they are based off of different SQL tables,

     there are times when the numbers are off. 

                        

Question:

     Why do I see more agents when I run a Query then I do when I create a Dynamic Group based on that Query ?

 

Environment:                                          

     CA Client Automation - All Versions

 

Answer:

    Queries are base off the ca_discovered_hardware table in SQL and Groups are based off the ca_agent table.

     When you delete an agent, it is supposed to also delete the ca_discovered_hardware record

    There are certain situation where these values can be off causing the number of records to be different.

 

   To check the values in SQL run the following SQL Queries:

      select count(*) from ca_discovered_hardware

      select count(*) from ca_agent where agent_type =1           ---agent type 1 are machines.

 

    To resolve this you can run the following SQL command (always backup the MDB before runing any SQL Queries):

        select count(*) from ca_discovered_hardware where dis_hw_uuid not in

         (select object_uuid from ca_agent where agent_type =1)

    This value should be the difference between the above queries (discovered_hardware and  ca_agent) 

        delete from ca_discovered_hardware where dis_hw_uuid not in

         (select object_uuid from ca_agent where agent_type =1)

 

   If you get an error  when running the above query you should open a support case.

   In that case you might need to delete records from the :   ca_link_dis_hw_user table .

 

 Additional Information:    

   This issue is often seen when you you enable User Profiles in the Configuration Policies:

   ...\DSM\Agent\Common Agent\Software Delivery:  Registration:Supported unit Type:   Computers + User Profiles

   Since if this is enable the ca_hardware record gets linked to the User Profile and can't be deleted until the User profile is deleted.