How To: Use PowerShell to Check Pending Reboot
Overview
This document will cover using PowerShell to check for any pending reboots.
Prerequisites
Administrator access to Windows PowerShell
Instructions
Open PowerShell as Administrator
Run the following command
$pendingReboot = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -ErrorAction SilentlyContinue
if ($pendingReboot -ne $null) {
Write-Host "Pending reboot detected."
} else {
Write-Host "No pending reboot found."
}
Here is a sample of the output that is returned when no reboot is needed:
Need Support?
Do you need help? You can access our support portal to create, view, and update tickets anytime.
https://cybercns.freshdesk.com
Click below to be directed to our secure support portal or email support@cybercns.com to open a ticket.
Â