ºÚÁϺ£½Ç91Èë¿Ú

Remove Inactive Devices via PowerShell

If your organization has a high number of inactive devices in ºÚÁϺ£½Ç91Èë¿Ú, you can use the ºÚÁϺ£½Ç91Èë¿Ú PowerShell Module to execute a clean up script and remove all inactive devices.

Important:

The following steps require the ºÚÁϺ£½Ç91Èë¿Ú PowerShell Module installed on your device. To download and install the ºÚÁϺ£½Ç91Èë¿Ú PowerShell Module, see Install the ºÚÁϺ£½Ç91Èë¿Ú PowerShell Module.

Connecting to Your Organization via PowerShell

Before running any commands, you'll first need to connect to the ºÚÁϺ£½Ç91Èë¿Ú PowerShell Module.

  1. Open Windows PowerShell on your device and execute the following command: Connect-JCOnline
  2. Enter the API key of your ºÚÁϺ£½Ç91Èë¿Ú account. To gather your API key, see Accessing Your API Key.
  3. Once you enter the API key, the ºÚÁϺ£½Ç91Èë¿Ú 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 ºÚÁϺ£½Ç91Èë¿Ú org: Get-JCSystem

Removing Inactive Devices from Your Organization

Warning:

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

Important:

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 ºÚÁϺ£½Ç91Èë¿Ú Organization via the Admin Portal.
    1. Log into your .
    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