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.
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.
- Open Windows PowerShell on your device and execute the following command:
Connect-JCOnline
- Enter the API key of your ºÚÁϺ£½Ç91Èë¿Ú account. To gather your API key, see Accessing Your API Key.
- Once you enter the API key, the ºÚÁϺ£½Ç91Èë¿Ú modules will be imported to the system. Your JCOrgID and JCOrgName are shown after successful import.
- Execute the following command to list all the devices in your ºÚÁϺ£½Ç91Èë¿Ú 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.
- 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.
- 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. - You can verify the removed devices are no longer visible in the Devices list within your ºÚÁϺ£½Ç91Èë¿Ú Organization via the Admin Portal.
- Log into your .
- Go to DEVICE MANAGEMENT > Devices and click the Devices tab.
- Cross-reference the Devices list with the output of removed devices from the PowerShell command.