How to create a collection of computers that doesn't have the Altiris Agent for specific organizational units or containers

book

Article ID: 181059

calendar_today

Updated On:

Products

Management Platform (Formerly known as Notification Server)

Issue/Introduction

 

Resolution

Question
How can I create a dynamic collection of computers that doesn't have the Altiris Agent for one or more specific organizational units or containers?

Answer

  1. Determine the distinguished name of the containers and/or organization units you want included in the collection by running the following SQL query against the Altiris database.

    select distinct [distinguished Name] from vResource vr
    join Inv_OU_Membership mem on mem.[_ResourceGuid] = vr.[Guid] 

    Tip: Copy the above SQL query and paste it into your SQL Query Analyzer or the Query function in the Microsoft Server Management Studio.
  2. Copy the complete "distinguished Name" of the containers or organizational units you want to include in the collection to a file.
  3. At the bottom of the following SQL query, replace the "Distinguished Name" entries (in red) with the distinguished name entries of the containers and/or organizational units you want included in the collection. Add additional distinguished name entries as wanted, making sure to maintain the needed syntax. Use the SQL Query syntax below as a example.

    Important: Make sure that you retain the syntax (enclose each distinguished name entry in single quotation marks (') and enter a coma (,) before each entry in the list except for the first entry). Don't change other items in the SQL query.  

    select Guid from vResource where Guid in (select Guid from (select distinct vr.Guid, mem.[Distinguished Name]       
    from vResource vr       
    join Inv_OU_Membership mem on mem.[_ResourceGuid] = vr.[Guid]       
    where Guid in  (         
        SELECT vc.[Guid] FROM vComputer vc         
        join inv_aex_ac_identification ii on  vc.guid = _resourceguid         
        WHERE vc.[Guid] NOT IN  (         
                SELECT DISTINCT agent.[_ResourceGuid]       
                FROM Inv_AeX_AC_Client_Agent agent         
                WHERE agent.[Agent Name] = 'Altiris Agent'   
      or agent.[Agent Name] = 'Altiris eXpress NS Client' )       
        AND  LOWER(vc.[OS Name]) LIKE '%'       
        AND LOWER(vc.[System Type]) like '%win%'         
        AND vc.[IsLocal] = 1   )       
     and mem.[Distinguished Name] in ( 
           'CN=COMPUTERS,DC=YOUR_DC,DC=YOUR_DC'
          ,'CN=USERS,DC=YOUR_DC,DC=YOUR_DC'
           ) 
     ) xxx)

    Tip: Copy the above SQL query and paste it into your SQL Query Analyzer or the Query function in the Microsoft Server Management Studio then paste the "Distinguished Name" entries for the containers and/or organization units obtained from the first SQL query.
  4. Test your query to make sure it is returning the expected results.
  5. In the Altiris Console, create a new collection and use your SQL query as the content for the collection.
    1. Determine where to place the collection. Create a new collection somewhere under the Resources tab > Collections. Note the location as you will need to be able to access it through the Collection Selector. You may want to use a "My Collections" folder.
    2. At a folder in the Collections, right-click and click New > Collection.
    3. In the right pane (New Collection) enter a descriptive name for the collection, something like "Computers without Altiris Agents in OU . . ." so you can easily determine the contents of the collection.
    4. Click the Query section and click the Enter SQL Directly option.
    5. Copy your modified SQL query from SQL Query Analyzer or the Microsoft Server Management Studio then paste the SQL query in the field.
    6. Click the Test button to verify the query worked. If you didn't get any results in the SQL too, you won't get results in this test either.
    7. Click the Apply button to save the collection.

This collection may be used in the Configuration tab > Altiris Agent >Altiris Agent Rollout > Altiris Agent Installation to install the Altiris Agent only to computers in the organization units and/or containers in the collection that don't have the Altiris Agent installed.