How to delete devices in bulk with the discovery_server remove_master_devices_by_cskeys callback?


Article ID: 143597


Updated On:


NIMSOFT PROBES DX Infrastructure Management


The snmpcollector devices were initially discovered on the Primary hub discovery agent but devices were moved to discovery scopes on secondary hub. These devices are no longer being monitored on the Primary hub.
USM inventory show many devices with both the Primary and Secondary origins and need a bulk device deletion method to clean up the primary hub origin.

I understand that I can manually delete the devices using the USM Inventory portlet deletion option but need an alternate method.


Release : 9.2.0



1. Create a Dynamic group with a Device filter by origin
2. Select the new Group and clicked on the Actions pull down menu, then selected the Export Group option and saved the *.csv file
3. Open the csv file with Excel or similar product and sort the device list by the Origin column
4. Copy the cs_key for devices with multiple origins to a text file and name it cs_keys.txt
5. Created the following batch file with the pu command with the discovery_server remove_master_devices_by_cskeys callback.
Note: replace adminstratorpassword with your UIM's administrator password


SET PASSWORD=administratorpassoword

FOR /F "tokens=*" %%A in (cs_keys.txt) do (
pu.exe -u administrator -p %PASSWORD% discovery_server remove_master_devices_by_cskeys %%A

6. Run the batch file with single cs_key in the cs_keys.txt file and confirm that device is deleted from the USM Inventory

7. Run the discovery wizard against the secondary hub Discovery Agent to repopulate the device and confirm that secondary hub origin is only seen.

8. Repeat steps 6 and 7 for the remaining cs_key

Additional Information

Delete server/device in UIM via command line tool

Remove devices from UIM