Auto Retire Offline Devices
Summary
The Auto Retire Offline Devices bot finds devices that have been offline in CW RMM for longer than their threshold and retires them by uninstalling the CW RMM agent. In ticket-only mode, it raises one ticket for each of those devices instead and removes nothing. It runs at each daily run of the Auto Retire Offline Devices workflow.
The bot runs inside the platform, so it uses the pre-authenticated RPA HTTP client for CW RMM and needs no CW RMM client ID or client secret. The base URL arrives automatically through the cwOpenAPIURL input.
How it works:
- Every company is checked for devices that have been offline for 7 days or more. Online devices are never looked at.
- Each device's name, OS, type and serial number are read.
- The device's settings are read from its endpoint, site and company custom fields.
- Scope: the device is skipped unless its settings cover it.
- Threshold: the device is skipped unless it has been offline for at least its threshold in days.
- Mode: in ticket-only mode, a ticket is raised unless the device's stored ticket is still open. Otherwise, the CW RMM agent is uninstalled.
- If a setting can't be used or a step fails, the device is left alone, the reason is written to its AR_Last_Result field, and the device is tried again at the next run.
Settings and how they're chosen
Each setting exists at three levels. The most specific level that holds a value wins, Disabled included, so a device set to Enabled is handled even when its company is Disabled. An empty value uses the level above. When the company has no value of its own, the default value of the company field applies, so the company fields' default values act as portal-wide defaults.
| Setting | Company | Site | Endpoint |
|---|---|---|---|
| Scope | AR_Enable | AR_Enable_Site | AR_Enable_Endpoint |
| Threshold in days | AR_Threshold_Days | AR_Threshold_Days_Site | AR_Threshold_Days_Endpoint |
| Ticket-only mode | AR_Ticket_Only | AR_Ticket_Only_Site | AR_Ticket_Only_Endpoint |
- Scope: the company and site fields cover devices by OS type, such as
Windows Workstations Only. A Windows device counts as a server when CW RMM reports it as a server or its OS name includes Server. Devices that are neither Windows nor macOS, such as Linux, are only handled when AR_Enable_Endpoint isEnabled. - Threshold: the offline time is counted from the last time the device contacted CW RMM. Thresholds below 7 days are refused.
- Ticket-only mode: when it isn't set at any level, the device is handled in ticket-only mode, so nothing is removed until someone sets it to
Disabled.
Tickets
In ticket-only mode, each device gets one ticket, raised on the MSP board, assigned to the MSP team, with Medium priority and the Alerting source. The device is attached to the ticket, and the summary reads Auto Retire: <device> is offline beyond its retirement threshold. The description lists the device's company, site, OS, serial number, last contact, days offline and threshold, and says which field to change to retire or keep the device.
The ticket's number is stored in AR_Ticket_Number. No new ticket is raised while that ticket is open. Once it's Closed or Resolved, a new ticket is raised at the next run if the device is still offline past its threshold and still in ticket-only mode.
Safety limits
- No more than 50 devices are retired in one run, so a setting changed by mistake can't clear out a whole company at once. Devices over the limit are retired at the following runs.
- A device whose settings can't be read, or hold a value the bot doesn't recognize, is left alone.
- Retiring is never retried blindly. If CW RMM reports an error, the bot checks whether the device is already gone before sending the uninstall again.
Run time
CW RMM stops a bot after 20 minutes. The bot doesn't start a new device after 14 minutes, and the devices it didn't reach are picked up at the next run. Devices are processed in random order, so in a very large environment every device is reached over a few runs. Temporary errors from CW RMM are retried up to five times.
API endpoints used
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/platform/v1/custom-field/definitions | Find the AR custom fields and the company fields' default values |
| GET | /api/platform/v1/company/companies | List the companies |
| GET | /api/platform/v1/company/sites | Read site names for tickets |
| GET | /api/platform/v2/device/endpoints/heartbeat | Find the devices offline for 7 days or more, with their last contact time |
| POST | /api/platform/v2/device/categories/platform/endpoints | Read each device's name, OS, type and serial number |
| GET | /api/platform/v1/company/companies/{companyId}/custom-fields | Read the company settings |
| GET | /api/platform/v1/company/sites/{siteId}/custom-fields | Read the site settings |
| GET | /api/platform/v2/device/endpoints/{endpointId}/custom-fields | Read the endpoint settings and the stored ticket number |
| PUT | /api/platform/v2/device/endpoints/{endpointId}/custom-fields | Write AR_Ticket_Number and AR_Last_Result |
| DELETE | /api/platform/v2/device/endpoints/uninstall | Uninstall the CW RMM agent |
| GET | /api/platform/v1/service/ticketing/service-boards | Find the MSP board |
| GET | /api/platform/v1/service/ticketing/service-boards/{boardId}/teams | Find the MSP team |
| GET | /api/platform/v1/service/ticketing/priorities | Find the Medium priority |
| GET | /api/platform/v1/service/ticketing/sources | Find the Alerting source |
| GET | /api/platform/v1/service/ticketing/statuses | Tell open tickets from Closed and Resolved ones |
| GET | /api/platform/v2/service/ticketing/tickets | Find the stored ticket, or an open ticket already raised for the device |
| POST | /api/platform/v2/service/ticketing/tickets | Raise the ticket |
Details
| Bot Name | Description | Execution Environment |
|---|---|---|
| Auto Retire Offline Devices | Retires devices offline longer than their threshold by uninstalling the CW RMM agent, or raises one ticket per device in ticket-only mode. Scope, threshold and mode come from AR_ custom fields at company, site and endpoint level. | Cloud |
Integration Configuration
| Platform | Platform Scopes | 3rd Party Apps | Integrations |
|---|---|---|---|
| True |
| False |
Form Setup
| Form Required | Form Template |
|---|---|
| No | N/A |
Functions
Forms Setup Path
- Tasks Path:
Automation➞Bots
Dependencies
- Custom Field: AR_Enable
- Custom Field: AR_Threshold_Days
- Custom Field: AR_Ticket_Only
- Custom Field: AR_Enable_Site
- Custom Field: AR_Threshold_Days_Site
- Custom Field: AR_Ticket_Only_Site
- Custom Field: AR_Enable_Endpoint
- Custom Field: AR_Threshold_Days_Endpoint
- Custom Field: AR_Ticket_Only_Endpoint
- Custom Field: AR_Ticket_Number
- Custom Field: AR_Last_Result
The bot takes no form input. It stops the run if any of the first ten custom fields is missing or was created at the wrong level, and the run's result message names the fields. AR_Last_Result is optional: without it, the reasons only appear in the run's log.
Consumed by:
Related content:
Implementation
Install the bot from the ProVal - Content Community, selecting the Bots repository, then publish the bot. After installation, the following configuration steps are mandatory.

1. Install the Custom Fields
Install the eleven custom fields listed in Dependencies from the ProVal - Content Community, selecting the Custom Fields repository.
2. Allow Agent Uninstallation
The bot uninstalls agents through the CW RMM API. It runs under the account that created the workflow, so that account needs access to every device you want handled and must be allowed to uninstall agents. If agent uninstallation is turned off for it, CW RMM answers ErrAgentUninstallationDisabled, and that message is written to AR_Last_Result.
3. Check the Ticket Settings
Ticket-only mode raises tickets on the MSP board, assigned to the MSP team, with Medium priority and the Alerting source. Confirm these exist in your CW RMM ticketing settings. If one is missing, the ticket isn't raised, and AR_Last_Result lists the names that do exist.
Primary Note: Retiring Is Permanent
CW RMM removes a retired device from the portal straight away and uninstalls its agent the next time the device comes online. To bring it back, the agent has to be installed again. Protect devices that are only used now and then with AR_Enable_Endpoint set to Disabled, and run in ticket-only mode first.
Primary Note: Reading the Bot Output
The bot's result message gives the totals for the run: devices offline for 7 days or more, out of scope, under threshold, tickets raised, open tickets left as they are, retired and failed. It also lists the devices retired, and says how many were held back by the 50 device limit or weren't reached in time. The reason for each failed device is in its AR_Last_Result field, which also lists the common reasons and how to fix them.
Changelog
2026-11-17
- Initial version of the document