Back to Resources

Level Verified

Windows Monitor - Restart Required Script

Created by

Level

Type

Script

Category

General

Platforms
WindowsApple iOSLinux

Problem Overview

Unrecognized pending restarts can compromise system stability and security, as critical updates or configuration changes remain incomplete. This script reduces the chance of oversight by detecting any signs that a reboot is required, helping IT Professionals and MSPs maintain reliable, up-to-date Windows environments.

Description

This PowerShell script scans multiple registry paths commonly associated with pending reboots, such as those triggered by Windows Updates, file renames, and system name changes. If it encounters any indicators suggesting a reboot is required, it prints an alert for easy visibility.

You can integrate it into a script-based monitor within Level to receive real-time notifications when a reboot is pending. Alternatively, set up a schedule in Level’s Automation to check regularly and ensure your machines are kept in an optimal state, avoiding stale updates and preventing unexpected downtime.

Script

<#
This resource is provided as a convenience for Level users. We cannot 
guarantee it will work in all environments. Please test before deploying 
to your production environment. We welcome contributions to our community 
library

Level Library
https://level.io/library/script-windows-monitor-restart-required
#>

function Get-PendingRebootStatus {
    # Check only the Windows Update reboot required key
    $WUAURebootReq = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' -ErrorAction SilentlyContinue
    return [bool]$WUAURebootReq
}

if (Get-PendingRebootStatus) {
    Write-Output "ALERT: Windows Update Reboot Required"
} else {
    Write-Output "No Windows Update reboot is required."
}

Use Cases

  • Monitoring servers after monthly Patch Tuesday updates
  • Detecting incomplete software installations or migrations
  • Confirming reboots after automated tasks or maintenance windows
  • Verifying pending restarts during large-scale workstation deployments

Recommendations

  • Test in a safe environment before deploying widely
  • Use a script-based monitor in Level for on-demand checks when updates are installed
  • Automate regular scans with Level’s scheduling options
  • Pair with a remediation script or manual reboot plan for systems flagged as needing a restart
  • Monitor output logs to confirm each system’s status after updates or changes

FAQ

  • How do I run this script in Level?
    Import the script as a resource, then attach it to a script-based monitor or create a scheduled Automation.
  • Does the script itself initiate a reboot?
    No, it only detects if a reboot is required. You’ll need a separate script or manual process to carry out the restart.
  • Which registry keys does it check?
    It scans several potential triggers for reboots, including Windows Update, component servicing, file rename operations, and machine name changes.
  • Why is a pending reboot potentially risky?
    Delayed reboots can result in incomplete patches or changes, leaving systems vulnerable or underperforming.
  • Can I customize which registry paths are checked?
    Yes, edit the PowerShell function to add or remove registry locations based on your environment’s needs.

Included with this Script:

Below is a list of what you can expect to find when importing this Script.

Script details:

The following data and settings will be imported with your script.

Script Name

Windows Monitor - Restart Required

Description

This PowerShell script checks Windows registry keys to detect if a system reboot is needed by monitoring for pending changes in system components, file operations, updates, and computer name changes.

Language

PowerShell

Timeout (In Seconds)

100

Run As

Local system

Import into Level

Related resources

Explore more automations, scripts, and policies to further enhance your IT operations.

View all resources