cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sw41
Level 10
Report Inappropriate Content
Message 1 of 14

Delete Duplicate Named computers

Does someone have a good script/query to detect duplicate computer names and delete the ones with the older checkin times keeping the one that checked in most recent?  Checkin is not always today.

13 Replies
NagendraPrabu
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 2 of 14

Re: Delete Duplicate Named computers

Hi @sw41 ,

Greetings!

By default, there is a query in ePO queries and reports to find the duplicated computer names. Have you tried it?

Was my reply helpful?

If you find this post useful, please give it a Kudos! Also, please don't forget to select "Accept as a Solution" if this reply resolves your query!
rackroyd
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 3 of 14

Re: Delete Duplicate Named computers

Copy the query: 'Duplicate system Names' as you can't modify the default queries.
Modify the copy to include the column: 'Last Communication' so you can see the last communication time.

This should hopefully give you the potential list of all machines you are looking for with the time criteria included.

In server tasks you can choose to run a query with sub-actions = Delete Systems.
But that as it stands would delete *all* duplicates, not just the 'oldest' ones.
The trick is to build the query to only return the machines you want removed rather than all duplicates.

You can probably look at adding a filter to the query along the lines of:

System name is duplicated
and Last Communication is not within the last <x> days/hours

apply whatever time/date criteria you wish to apply...
Test the query *a lot* before you feed it into a server task so you don't accidentally remove the wrong machines.

Hth





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?
sw41
Level 10
Report Inappropriate Content
Message 4 of 14

Re: Delete Duplicate Named computers

I don't get the right results when filtering by date.  The non persistent VDI names can have a couple in the same day based on shift change.  The workstations are usually spread out date wise but the most recent may not have checked in for a day or 2 (home user leaving the computer off).

cdinet
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 5 of 14

Re: Delete Duplicate Named computers

See attached script.

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?

VladimirP
Level 7
Report Inappropriate Content
Message 6 of 14

Re: Delete Duplicate Named computers

Can you please reupload this script,  I get "The requested resource is not available." from that link,

Thank you 

cdinet
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 7 of 14

Re: Delete Duplicate Named computers

Sure thing

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?

VladimirP
Level 7
Report Inappropriate Content
Message 8 of 14

Re: Delete Duplicate Named computers

Thanks, this seems to be an SQL script that needs to be run against SQL DB itself.

ePo doesn't have any way to make a query that within ePo itself to compare 2 systems and return older ones ?

 

cdinet
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 9 of 14

Re: Delete Duplicate Named computers

There is a default duplicate query in epo, but that returns all duplicates.  I personally don't have any query that will do what you want in epo.  

 

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?

VladimirP
Level 7
Report Inappropriate Content
Message 10 of 14

Re: Delete Duplicate Named computers

Yeah ive been trying to edit it and make it less useless but ePo functionality is very limited, best it can do it seems is filter it by "last communication not within X hour/days"   but then for example i say 7 days but then both old duplicate and legit system where not online for a week it will delete both.

SQL script seems to do what i need, but then what's the point of ePo frontend if you have to fiddle with SQL for something so simple ?

is there any other way to find identify duplicates ?

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