Remove Inactive Devices via PowerShell

If your organization has a high number of inactive devices in JumpCloud, you can use the JumpCloud PowerShell Module to execute a clean up script and remove all inactive devices.


The following steps require the JumpCloud PowerShell Module installed on your device. To download and install the JumpCloud PowerShell Module, see Install the JumpCloud PowerShell Module.

Connecting to Your Organization via PowerShell

Before running any commands, you'll first need to connect to the JumpCloud PowerShell Module.

  1. Open Windows PowerShell on your device and execute the following command: Connect-JCOnline
  2. Enter the API key of your JumpCloud account. To gather your API key, see Accessing Your API Key.
  3. Once you enter the API key, the JumpCloud modules will be imported to the system. Your JCOrgID and JCOrgName are shown after successful import.
  4. Execute the following command to list all the devices in your JumpCloud org: Get-JCSystem

Removing Inactive Devices from Your Organization


This command will permanently remove the devices that fall within the criteria. There is no recovery or undo script. Proceed with caution.

  1. The following command will permanently remove all the devices that have a lastContact date greater than 60 days.

Get-JCSystem | Where-Object lastContact -lT (Get-Date).AddDays(-60).ToString('yyy-MM-ddTHH:MM:ss') | Remove-JCSystem


You can modify the number of days since last contact according to your requirements (for example 30, 60, 90, 120, etc). To do so, modify the value within the AddDays(-XX) field.

  1. PowerShell prompts for confirmation to remove the selected devices. Select Y (yes) to remove the devices.
    After the successful execution of the command, a list of removed devices is displayed.
  2. You can verify the removed devices are no longer visible in the Devices list within your JumpCloud Organization via the Admin Portal.
    1. Log into your JumpCloud Admin Portal.
    2. Go to DEVICE MANAGEMENT > Devices and click the Devices tab.
    3. Cross-reference the Devices list with the output of removed devices from the PowerShell command.
Back to Top

Still Have Questions?

If you cannot find an answer to your question in our FAQ, you can always contact us.

Submit a Case