How to deduplicate computer objects in EPM using Computers APIs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Endpoint Privilege Manager (EPM) Articles
4 min read
L1 Bithead
No ratings

Following EPM endpoint agent upgrade or reinstall, the My Computers page of the administrator console is showing significantly more machines than before, with many showing apparent duplicate entries.

 

The cause:

EPM's agent has a uniquely generated Agent ID that is the primary identifier when communicating with EPM SaaS.  It can be deleted with an uninstallation with specific flags across different platforms. 

 

There are 2 levels of deletions within the DB:

  1. The first is a soft-delete, which marks a file/agent/event for deletion. This removes it from the UI, reports, counters, and everything else customer facing. It is also relatively light on the DB
  2. The second is a hard-delete, this is a set of background jobs which run all the time taking batches of items which have been soft-deleted and performing the heavy work of actually removing them from the DB. It is significantly heavier in terms of effort and for this reason only occurs in small batches. 

In some instances, a backlog of soft-deleted items can accumulate which have not yet been hard-deleted. 

During the upgrade - agents that had only been 'soft-deleted' but not yet 'hard-deleted' were added back to the "alive list". Resulting in a higher number of agents post install than had existed before.

 

Resolution:

When several agent duplicates exist, there could be license implications and policy targeting implications to consider, therefore ensuring you're running lean with your EPM agents is essential for success.  Using EPM's APIs in a script on a periodic basis could help with keeping this agent list cleaned out in addition to EPM's already existing cleanup mechanisms.

 

Attached to this article is a PowerShell script written to interact with EPM's Computers APIs to ultimately deduplicate existing agents.  It is purposely written to only delete duplicates and not existing agents by referencing the installation time.

Steps

Pre-Requisites:

  1. An existing EPM service user and EPM configured to allow for direct authentication
    1. For more information see our docs: https://docs.cyberark.com/epm/latest/en/content/admin/role-based-access-management.htm#add-user
  2. Download the script
  3. Identify your login dispatcher URL
  4. Identify your set ID

 

Steps:

  1. Set your login dispatcher - Edit the line 32 to reflect your login dispatcher that is one of the following:
    1. North America - https://login.epm.cyberark.com
    2. Europe - https://eu.epm.cyberark.com
    3. UK - https://uk.epm.cyberark.com
    4. Australia - https://au.epm.cyberark.com
    5. Canada - https://ca.epm.cyberark.com
    6. Singapore - https://sg.epm.cyberark.com
    7. India - https://in.epm.cyberark.com
    8. Japan - https://jp.epm.cyberark.com
    9. Italy - https://it.epm.cyberark.com
    10. Czech Republic - https://ch.epm.cyberark.com
    11. UAE - https://ae.epm.cyberark.com
    12. Israel - https://il.epm.cyberark.com
    13. Brazil - https://br.epm.cyberark.com
    14. FedRAMP - https://login.epm.cyberarkgov.cloud

Example for FedRAMP:

    1. ka3Vy00000AKZAMIA5__eid=ka3Vy00000AKZAM&feoid=00N2J000009R3kv&refid=0EMVy00000eF33R.png
  1. Identify your set ID that you'd like to run this on
      1. Pro tip: Triple-click to select the whole set ID
      2. ka3Vy00000AKZAMIA5__eid=ka3Vy00000AKZAM&feoid=00N2J000009R3kv&refid=0EMVy00000eEm5r.png
    1. From the EPM Console, click on Administration > Sets > select the set you like > Set Details
    2. Paste this into line 11 within the double quotes "Insert your set ID here"
  2. Insert your service user ID and password

Note: Hard-coding credentials is NOT something that is a recommended practice and leaving them in perpetuity after use. Ideally, use a credential provider such as Idira Credential Providers, Idira Secrets Manager to replace these hard-coded credentials with API calls. However, if you don’t own these solutions, if you do paste the hard-coded credential, be sure to have a standard operating procedure of rotating that credential after use.

    1. Insert your EPM username within the double quotes "Insert your username"
    2. Insert your EPM password within the double quotes "Insert your password"

       4. Once these values are in-place, run the script.  If there are no errors returned, then you should see an output of Getting computers: currently on page X indicating which page the script is on.  If no machines are to be deleted, then it will return with no results

a.Example of return without results

    1. ka3Vy00000AKZAMIA5__eid=ka3Vy00000AKZAM&feoid=00N2J000009R3kv&refid=0EMVy00000eEvXG.png

b. Example of return with results:

    1. Before:
      1. ka3Vy00000AKZAMIA5__eid=ka3Vy00000AKZAM&feoid=00N2J000009R3kv&refid=0EMVy00000eFX4f.png
    2. Script execution:
      1. ka3Vy00000AKZAMIA5__eid=ka3Vy00000AKZAM&feoid=00N2J000009R3kv&refid=0EMVy00000eFBAd.png
    3. After:
      1. ka3Vy00000AKZAMIA5__eid=ka3Vy00000AKZAM&feoid=00N2J000009R3kv&refid=0EMVy00000eFX33.png
Rate this article:
  • 495 Views
  • 0 comments
  • 0 Likes
Article Dashboard
Version history
Last Updated:
‎11-05-2026 11:46 AM
Updated by: