Back to Resources
Level
Script
General
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.
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.
<#
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."
}
Windows Monitor - Restart Required
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.
PowerShell
100
Local system
Explore more automations, scripts, and policies to further enhance your IT operations.