02-03-2024 11:47 PM - edited 02-05-2024 04:21 AM
Hello Admins,
In this guide, we'll explore how to effectively bulk delete JumpCloud devices from the admin console using a CSV file and JumpCloud PowerShell Module, streamlining your workflow and keeping your systems organized.
Efficiency is key in any operation, especially when it comes to managing devices in your system and at times, the ability to quickly and efficiently delete multiple devices at once can save you valuable time and resources. Whether you're tidying up your admin console or preparing your organization for compliance auditing, these scripts can prove invaluable for bulk deletion of devices.
NOTE - Deletion of devices from the console will uninstall the JumpCloud Agent from any active Systems and permanently remove all System data and associations. This action CANNOT be undone. In the case of macOS and Windows, where FileVault and BitLocker encryption are turned on respectively, and the recovery key has been set, it's advised to back up the recovery keys for the devices being deleted, to avoid device lockout later. |
First prepare a CSV file with the 'SystemID' field (case sensitive), add the systemIDs of the devices you wish to permanently delete from your admin console and save the file.
Next, open Powershell and Install the JumpCloud PowerShell Module (incase you do not have it already installed) or update the module (in case you get prompted of an available update) and connect to your JumpCloud instance using 'Connect-JCOnline' cmdlet and your API key from the admin console.
Navigate to the path where the CSV is stored and run the below cmdlet to delete the systems listed in the CSV file with approval prompts for each deletion:
Import-CSV ./FILENAME.csv | % {Remove-JCSystem -SystemID $_.SystemID}
The output of the result is as displayed in the above screenshot, which shows hostname, systemID and deletion status of the devices.
In case, if you wish the script to automatically remove the systems without a prompt for every system, run this cmdlet instead:
Import-CSV ./FILENAME.csv | % {Remove-JCSystem -SystemID $_.SystemID -Force}
The output of the result is as displayed in the above screenshot, where admins would not be prompted to approve each deletion.
This concludes bulk deletion of devices using a CSV file and JumpCloud Powershell Module.
To bulk delete all JumpCloud devices that have not contacted JumpCloud in the last 'X' days, you can utilize the following cmdlet, modifying the value of 'X' to the desired number of days (for example, 30, 60, 90, 120, etc.) :
Get-JCSystem -filterDateProperty lastContact -dateFilter before -date (Get-Date).AddDays(-X) | Remove-JCSystem
Hope this was helpful! Until next time 😄
09-10-2024 05:32 AM
Hi Saifshaik,
This script was very helpful!
anyway, can we bypass the approval prompts during remove the devices that has been inactived for more than 30 days?
09-13-2024 03:30 AM - edited 09-13-2024 03:31 AM
Glad the script was helpful @AndriankaF. Here's the command to achieve your requirement -
Get-JCSystem -filterDateProperty lastContact -dateFilter before -date (Get-Date).AddDays(-30) | Remove-JCSystem -Force
Hope this helps!
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.