SERVER-010 · Script
Pending Reboot Report Across Servers
Reports which servers are waiting for a restart, and why, along with last boot time and uptime.
Version 1.0.0Language PowerShellUpdated November 2026Report only, changes nothing
What it does
Reads the standard Windows restart markers remotely through the registry provider over CIM:
- Component servicing: (updates or roles installed and waiting to finish)
- Windows Update: (updates installed and waiting for a restart)
- File rename: (files queued to be replaced at the next start)
- Computer name change: (a rename that has not taken effect yet)
Targets are the computers you name, the servers in an OU, or this computer. Read-only. The file rename marker is set by many installers and is reported but not counted as pending unless -CountFileRename is used.
Requirements
Windows PowerShell 5.1. Admin rights on the target servers (WinRM or DCOM). The ActiveDirectory module (RSAT) only when -SearchBase is used.
How to run it
- Run as: a service account with the directory rights the script lists, or SYSTEM on a domain controller or the server being checked
- Run from: a domain-joined management server or admin workstation with the RSAT tools, as a scheduled task or from your management tool
- Script type: PowerShell 5.1, 64-bit
- User interaction: none; the script never prompts
- Timeout: 30 minutes for large directories or many servers
Settings
| Name | What it does | Options | Default |
|---|---|---|---|
| ComputerName | Servers to check. If empty, uses -SearchBase, or this computer. | (none) | |
| SearchBase | OU (distinguished name) whose enabled servers are checked. | ||
| CountFileRename | Treat queued file renames as a pending restart. | False | |
| AlertOn | Pending (default) exits 1 when any server needs a restart or cannot be reached. Never always exits 0. | Pending, Never | Pending |
| Server | Optional domain controller used to read the OU. |
Exit codes
- 0 = No restarts pending (or AlertOn is Never)
- 1 = One or more servers need a restart or could not be reached
- 2 = Script error (see log)
Testing steps
- Run it on one test OU, test account or test server and check the output and log.
- Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
- Roll out to a small group next, then everyone.
Rollback steps
Report only. Nothing is changed, so nothing needs to be rolled back.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |