Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Query to find all targets associated with policies

Created: 11 Jun 2012 • Updated: 11 Jun 2012 | 2 comments
This issue has been solved. See solution.

We are migrating from Altiris 7.0 to 7.1.  We found out that monitoring policy targets do not get migrated over if you have custom targets.  We have A LOT of custom targets.  Does anyone know of a query that will show us all targets and their associated monitor policy that they are a part of?  If not, maybe a query that is close that could set me on my way to building such a query?  Thanks.

Comments 2 CommentsJump to latest comment

Andrew Bosch's picture

This should get you started:

SELECT nri.Name [Monitor Policy], ri.Name [Resource Target]
FROM vNonResourceItem nri
JOIN vResourceTargetUses rtu
   ON rtu.ItemGuid = nri.Guid
JOIN vNonResourceItem ri
   ON ri.Guid = rtu.ResourceTargetGuid
WHERE nri.ClassGuid = '0821A65B-5338-464C-824D-9F7CEC48EA56' --Monitor Policies

------------------------------------
Sr. Principal SQA Engineer
Symantec

SOLUTION
jparrott's picture

That is very helpful thank you.  I added some more to the query to find the actual target computers as well as the target filters:

SELECT nri.name [Monitor Policy], vc.name [Resource Target]
FROM vNonResourceItem nri
JOIN vResourceTargetUses rtu
  ON rtu.ItemGuid = nri.Guid
JOIN vNonResourceItem ri
  ON ri.Guid = rtu.ResourceTargetGuid
JOIN targetfilter tf
  ON tf.resourcetargetguid = rtu.resourcetargetguid
JOIN targetfilterresource tfr
  ON tfr.targetfilterguid = tf.guid
JOIN vComputer vc
  ON tfr.resourceguid = vc.guid
WHERE nri.ClassGuid = '0821A65B-5338-464C-824D-9F7CEC48EA56' --Monitor Policies
UNION ALL
SELECT nri.Name [Monitor Policy], ri.Name [Resource Target]
FROM vNonResourceItem nri
JOIN vResourceTargetUses rtu
   ON rtu.ItemGuid = nri.Guid
JOIN vNonResourceItem ri
   ON ri.Guid = rtu.ResourceTargetGuid
WHERE nri.ClassGuid = '0821A65B-5338-464C-824D-9F7CEC48EA56' --Monitor Policies
ORDER BY [Monitor Policy], [Resource Target]