Skip to main content

Reboot Pending Prompt - Autofix

Overview

This script acts as the remediation (Autofix) component of the "Reboot Pending Prompt" solution. It is triggered automatically when the Detection script determines that a reboot is necessary and conditions are right to interrupt the user.

Since RMM scripts run in the background (Session 0) and cannot normally show windows to the user, this script utilizes a temporary Scheduled Task to bypass this limitation. It launches a branded GUI utility (Prompter.exe) inside the active user's session. Depending on how many times the user has already postponed the reboot, the script will either present a "Yes/No" deferral option or a "Final Warning" that enforces the reboot after a few minutes.

Sample Run

Note:

  • It is not recommended to run this script manually. The script is designed for the Autofix script of Reboot Pending Prompt - Windows Workstation compound condition.
  • Prompter requires '.NET Desktop Runtime 8.0' to run. If missing, the script automatically downloads and installs it silently.

Dependencies

Custom Fields

Custom FieldDefaultExampleDescription
cPVAL Reboot Prompt Count45Max deferrals allowed before a forced reboot.
cPVAL Reboot Prompt Duration Between Prompt42Minimum hours to wait between prompts. Used for message display text only in this script.
cPVAL Reboot Prompt TitleUpdates Installed - Reboot RequiredIT Dept: Important UpdatesTitle of the GUI window.
cPVAL Reboot Prompt MessageAn update has been installed on your computer. Would you like to restart now to complete the installation of updates? You have {X} prompt(s) remaining before a forced reboot. Next prompt will be sent in {Y} hours.We installed security patches.

Resulting Prompt: We installed security patches. Would you like to restart now? You have {X} prompt(s) remaining before a forced reboot.
Custom message body. The script automatically appends the question and remaining count to whatever text you provide. Avoid using single quotation marks (') in the message. Use regular quotes (") if needed.
cPVAL Final Prompt MessageAn update has been installed on your computer. This is the final prompt before your computer will automatically restart to complete the installation of updates. Please save your work. Your computer will be restarted after {X} minute(s) after you acknowledge this prompt.Deferrals exhausted.

Resulting Prompt: Deferrals exhausted. This is the final prompt before your computer will automatically restart. Your computer will be restarted after {X} minute(s) after you acknowledge this prompt.
Message displayed when no deferrals remain. The script automatically appends the reboot warning and timer to your text. Avoid using single quotation marks (') in the message. Use regular quotes (") if needed.
cPVAL Reboot Prompt Timeout30060Time in seconds before a "Warning" prompt closes automatically (defaults to deferral).
cPVAL Final Prompt Timeout900120Time in seconds before a "Final" prompt closes automatically (defaults to forced reboot).
cPVAL Final Prompt Reboot Delay Minutes510Grace period (in minutes) after final acknowledgment before the forced reboot occurs.
cPVAL Reboot Prompt Header ImageC:\Logos\header.png or https://example.com/logo.pngLocal file path or URL for the header image.
cPVAL Reboot Prompt Icon ImageC:\Logos\icon.icoLocal file path or URL for the icon image.
cPVAL Reboot Prompt ThemeDarkLightUI Theme: "Dark" or "Light".
cPVAL Reboot if Not Logged InDisableEnableForces reboot immediately if no user session is active.
cPVAL Last Prompted2024-05-20 14:30:00Updated to current timestamp if user defers. Updated by script.
cPVAL Times Prompted2Incremented by 1 if user defers. Resets to 0 on Reboot. Updated by script.
cPVAL Pending RebootFalseSet to False upon successful reboot initiation. Updated by script.

Automation Setup/Import

Automation Configuration

Output

  • Activity Details: Logs the interaction result (e.g., "User declined reboot", "User opted to reboot", or "Final prompt acknowledged").
  • Custom Field: Updates cPVAL Last Prompted and increments cPVAL Times Prompted if the user defers. Resets all tracking fields if the reboot is initiated.
  • User Prompt

Sample Prompts

With Default Values:
Image1

With Custom Header and Icon Image:
Image2