Creating a Reboot Worklet

Issue

You need to restart devices on demand or on a schedule — for example, to clear a pending "Reboot Required" state from updates that installed but did not restart the device. You want a reusable Worklet that reboots targeted devices independently of a patch policy.

Environment

  • Automox (current agent release)
  • Windows, macOS, or Linux devices
  • Console areas: Manage Policies, Worklet Catalog

Overview

Two things can reboot a device in Automox, and they solve different problems:

  • Patch policy reboot options — a patch policy can restart a device after it patches. Use this when the only reboots you care about are the ones patching triggers. See Using Restart Notifications.
  • A reboot Worklet — a standalone policy whose only job is to restart the device. Use this when you need to reboot on demand or on a set schedule regardless of patching: clearing a lingering "Reboot Required" state, finishing a third-party install, or a recurring maintenance-window restart.

If you only need a restart tied to patching, use the patch policy option and stop here. Use a Worklet for everything else.

Resolution

Option A — Use the prebuilt Worklet (fastest)

Automox publishes a verified reboot Worklet in the Worklet Catalog:

To use one:

  1. Open the Worklet Catalog and search for the Worklet name above.
  2. Click the Worklet, review its evaluation and remediation code, then create a policy from it.
  3. Assign the target device group and set a schedule.
  4. Save and let it run on schedule, or run it on demand.

Option B — Build your own reboot Worklet

Build one when you want a simple, forced restart on any OS:

  1. Go to Manage Policies Create Policy and choose Worklet.
  2. Enter a descriptive name (for example, "Force Reboot") and select the target operating system.
  3. On the Configuration tab, add the two code blocks:
    • Evaluation code: exit 1 — a non-zero exit tells Automox the device is out of compliance, so the remediation always runs.
    • Remediation code: exit 0 — the restart itself is handled by the notification setting in the next step, so the remediation only needs to complete successfully.
  4. Open the User Notifications section and enable Force automatic restart after Worklet completion. This is what actually reboots the device.
  5. Set a schedule if you want the reboot to recur, or leave it manual to run on demand.
  6. Assign the device group and save.

To run either Worklet immediately, open it and use Run Worklet Now (or run it against a single device from the device's Policies tab).

Notes

  • The exit 1 / exit 0 pattern in Option B intentionally makes the Worklet report the device as "needing remediation" every run, so it reboots each time it executes. That is expected — a reboot Worklet has no "already compliant" state.
  • Confirm target devices are online and connected before running; a reboot Worklet has no effect on a device that is not checked in.
  • A forced restart closes running applications. Where possible, run reboot Worklets during a maintenance window and use the notification delay so users can save work.
  • For a full walkthrough of authoring Worklets, see Creating a Worklet.
Was this article helpful?
0 out of 0 found this helpful