Skip to main content

Auto Reboot Management

Overview​

This automation is the engine of the Auto Reboot Management - NinjaOne solution. It reads the Auto Reboot Management custom fields of every Windows device through the NinjaOne API, works out the schedule that applies to each device, and writes a restart request to cPVAL Auto Reboot Scheduled For on every device due to restart before its next run. The device then restarts itself through the reboot trigger compound conditions. The automation also schedules maintenance mode around the restart, checks whether earlier restarts happened, and keeps cPVAL Auto Reboot Status and cPVAL Auto Reboot Failure current.

note

The Auto Reboot Management scheduled task runs this automation every hour, at 5 minutes past the hour, on one device. Don't schedule it anywhere else: every run covers the whole tenant, so running it on more devices writes every request several times and uses up the API rate limit. The automation changes nothing on the device it runs on.

note

The automation works in the time zone of the device it runs on. It reads the selected restart days and times in that time zone, and every time it writes to cPVAL Auto Reboot Status and cPVAL Auto Reboot Failure is in that time zone too, which the TimeZone column and the end of each failure show. For devices in other time zones, see Time Zones.

Requirements​

How It Works​

  1. Authenticate: reads the Client ID and Client Secret from the secure custom fields and signs in to the NinjaOne API.
  2. Read: reads every Windows device, the Auto Reboot Management custom fields at every level, and which servers run the domain controller or Hyper-V services.
  3. Check earlier restarts: compares each device's last boot time with the restart it last requested, and records the result.
  4. Request restarts: writes the restart time to cPVAL Auto Reboot Scheduled For on every online device due to restart before the next run, within the hour, and schedules maintenance mode around it. A device that's offline is recorded as Skipped - Offline and restarts at its next scheduled time.
  5. Record: updates cPVAL Auto Reboot Status where a value changed, records new failures in cPVAL Auto Reboot Failure, and clears the fields of devices no longer enabled.

Sample Run​

Default settings​

Run every hour by the Auto Reboot Management scheduled task on one device of a US2 instance.

Script VariableValue
Instance URLus2.ninjarmm.com
Schedule Interval Minutes60

Image1

Another NinjaOne instance​

Run every hour on one device of an EU instance, using the default interval of 60 minutes.

Script VariableValue
Instance URLeu.ninjarmm.com

Image2

Parameters​

NameCalculated NameExampleAccepted ValuesRequiredDefaultTypeDescription
Instance URLinstanceUrlus2.ninjarmm.comAny valid NinjaOne instance hostFalseus2.ninjarmm.comstring/textNinjaOne instance the API application belongs to. Must match the tenant's region.
Schedule Interval MinutesscheduleIntervalMinutes6060 to 240False60IntegerHow often the automation runs, in minutes. Restarts due within this many minutes of the start of the run are requested, so it must match the Recur every value of the Auto Reboot Management scheduled task: 60 for every hour.

Custom Fields​

Custom FieldScopeTypeDescription
cPVAL Ninja API Client IDSystemSecureClient ID of the API application. Read at runtime.
cPVAL Ninja API Client SecretSystemSecureClient Secret of the API application. Read at runtime.
cPVAL Auto RebootOrganization, Location, DeviceDrop-downWhich Windows devices are restarted.
cPVAL Auto Reboot Include DCOrganization, Location, DeviceDrop-downIncludes domain controllers.
cPVAL Auto Reboot Include Hyper-V HostOrganization, Location, DeviceDrop-downIncludes Hyper-V hosts.
cPVAL Auto Reboot DaysOrganization, Location, DeviceMulti-selectDays of the week to restart on.
cPVAL Auto Reboot TimeOrganization, Location, DeviceDrop-downTime of the restart.
cPVAL Auto Reboot Week ServerOrganization, Location, DeviceDrop-downWeek of the month servers restart in.
cPVAL Auto Reboot Week WorkstationOrganization, Location, DeviceDrop-downWeek of the month workstations restart in.
cPVAL Auto Reboot Maint Minutes ServerOrganization, Location, DeviceIntegerMaintenance mode minutes around a server restart.
cPVAL Auto Reboot Maint Minutes WorkstationOrganization, Location, DeviceIntegerMaintenance mode minutes around a workstation restart.
cPVAL Auto Reboot Pending Check ServerOrganization, Location, DeviceDrop-downRestarts servers only when a reboot is pending.
cPVAL Auto Reboot Pending Check WorkstationOrganization, Location, DeviceDrop-downRestarts workstations only when a reboot is pending.
cPVAL Auto Reboot Failure TicketOrganization, Location, DeviceDrop-downNot read by this automation. Used by the reboot failure compound conditions.
cPVAL Auto Reboot StatusDeviceWYSIWYGWritten with the effective schedule, next restart and result of the last restart.
cPVAL Auto Reboot FailureDeviceTextWritten when a scheduled restart fails.
cPVAL Auto Reboot Scheduled ForDeviceTextWritten with the restart time in UTC when a restart is due.
note

Every Auto Reboot Management custom field needs its API permission set to Read Only or Read/Write, and cPVAL Auto Reboot Status, cPVAL Auto Reboot Failure and cPVAL Auto Reboot Scheduled For need Read/Write. The run fails before anything is changed if a field is missing or has the wrong type.

Dependencies​

Automation Setup/Import​

Automation Configuration

Output​

Changelog​

2026-11-11​

  • Initial version of the document