Skip to main content

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:

  1. Every company is checked for devices that have been offline for 7 days or more. Online devices are never looked at.
  2. Each device's name, OS, type and serial number are read.
  3. The device's settings are read from its endpoint, site and company custom fields.
  4. Scope: the device is skipped unless its settings cover it.
  5. Threshold: the device is skipped unless it has been offline for at least its threshold in days.
  6. 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.
  7. 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.

SettingCompanySiteEndpoint
ScopeAR_EnableAR_Enable_SiteAR_Enable_Endpoint
Threshold in daysAR_Threshold_DaysAR_Threshold_Days_SiteAR_Threshold_Days_Endpoint
Ticket-only modeAR_Ticket_OnlyAR_Ticket_Only_SiteAR_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 is Enabled.
  • 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

MethodEndpointPurpose
GET/api/platform/v1/custom-field/definitionsFind the AR custom fields and the company fields' default values
GET/api/platform/v1/company/companiesList the companies
GET/api/platform/v1/company/sitesRead site names for tickets
GET/api/platform/v2/device/endpoints/heartbeatFind the devices offline for 7 days or more, with their last contact time
POST/api/platform/v2/device/categories/platform/endpointsRead each device's name, OS, type and serial number
GET/api/platform/v1/company/companies/{companyId}/custom-fieldsRead the company settings
GET/api/platform/v1/company/sites/{siteId}/custom-fieldsRead the site settings
GET/api/platform/v2/device/endpoints/{endpointId}/custom-fieldsRead the endpoint settings and the stored ticket number
PUT/api/platform/v2/device/endpoints/{endpointId}/custom-fieldsWrite AR_Ticket_Number and AR_Last_Result
DELETE/api/platform/v2/device/endpoints/uninstallUninstall the CW RMM agent
GET/api/platform/v1/service/ticketing/service-boardsFind the MSP board
GET/api/platform/v1/service/ticketing/service-boards/{boardId}/teamsFind the MSP team
GET/api/platform/v1/service/ticketing/prioritiesFind the Medium priority
GET/api/platform/v1/service/ticketing/sourcesFind the Alerting source
GET/api/platform/v1/service/ticketing/statusesTell open tickets from Closed and Resolved ones
GET/api/platform/v2/service/ticketing/ticketsFind the stored ticket, or an open ticket already raised for the device
POST/api/platform/v2/service/ticketing/ticketsRaise the ticket

Details​

Bot NameDescriptionExecution Environment
Auto Retire Offline DevicesRetires 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​

PlatformPlatform Scopes3rd Party AppsIntegrations
True
  • Platform - Devices - Read
  • Platform - Devices - Update
  • Platform - Devices - Delete
  • Platform - Companies - Read
  • Platform - Sites - Read
  • Platform - Custom Fields - Read
  • Platform - Tickets - Read
  • Platform - Tickets - Create
False

Form Setup​

Form RequiredForm Template
NoN/A

Functions​

Forms Setup Path​

  • Tasks Path: Automation ➞ Bots

Dependencies​

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.

Image1

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