cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Make a "Queries" from SQL request

Hello,

I have created an SQL query for finding all system duplicated with same TAG and same Assignment path (and other criteria), whiteout the last communications system.

I need to add this request in ePO Queries to use it in server Tasks.

Can we import an SQL request in "Queries" ?

 

My SQL request (truncate😞

select
 [EPOLeafNode].[AgentGUID],
 [EPOLeafNode].[LastUpdate],
 [EPOLeafNode].[NodeName],
 [EPOLeafNode].[ParentID],
 [EPOLeafNode].[Tags],
 [EPOLeafNode].[AutoID]

from
 [EPOLeafNode]

where
 (
  (
   [EPOLeafNode].[AgentGUID] in (
    SELECT
     a.AgentGUID
    FROM
     EPOLeafNode AS a,
     EPOLeafNode AS b
    WHERE
     a.NodeName=b.NodeName
     AND a.Type=b.Type
     AND a.Type=1
     AND a.AutoID!=b.AutoID
     AND a.Tags = b.Tags
     AND a.ParentID = b.ParentID
     AND a.LastUpdate > b.LastUpdate

   )
  )
 )
order by [EPOLeafNode].[NodeName] asc

 

3 Replies
cdinet
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 2 of 4

Re: Make a "Queries" from SQL request

No, unfortunately, that isn't a current feature.  You can submit an idea for that - follow kb60021.  What exactly are you trying to accomplish? 

Was my reply helpful?
If this information was helpful in any way or answered your question, will you please select Accept as Solution in my reply and together we can help other members?

Re: Make a "Queries" from SQL request

Thank form you reply cdinet.

I have found an existing idea : https://community.mcafee.com/t5/Business-Ideas/Advanced-Reporting-via-SQL-query-in-ePO/idi-p/587551?...

 

In a big organisation we can have many (very many) duplicate. (Devices remasters, hardware upgrade ...)

To manage these duplicates is very time-consuming.

The standard request for duplicate device show all system with duplicate hostname. But I don't want only delete the oldest system, not the newest.

 

cdinet
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 4 of 4

Re: Make a "Queries" from SQL request

You can use this query in sql and run it as a job periodically.  Just be sure to validate table names, as that can change with epo versions.

delete from epoleafnode where exists (select * from epoleafnode as l where l.nodename=epoleafnode.nodename and l.autoid!=epoleafnode.autoid and l.lastupdate>epoleafnode.lastupdate)

SET rowcount 1000
delete from epoleafnode where exists (select * from epoleafnode as l where l.nodename=epoleafnode.nodename and l.autoid!=epoleafnode.autoid and l.lastupdate>epoleafnode.lastupdate)
WHILE @@rowcount > 0
BEGIN
delete from epoleafnode where exists (select * from epoleafnode as l where l.nodename=epoleafnode.nodename and l.autoid!=epoleafnode.autoid and l.lastupdate>epoleafnode.lastupdate)
END
SET rowcount 0

Was my reply helpful?
If this information was helpful in any way or answered your question, will you please select Accept as Solution in my reply and together we can help other members?

You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community