Some windows updates require a system restart after installation because it needs to change some system files which are currently used by running processes, or changes in registry. You’ll be prompted with the yellow icon shield like in fig-1.
Windows created a registry subkey RebootRequired under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update to detect this pending state.
So, for easy job, I wrote the little batch script (for windows XP & Server 2003) and powershell script (for Windows Vista & Server 2008 or later) to detect this key. Use either of the script.
Fig-2 & Fig-3 shows running the batch script on computer which needs pending restart & which doesn’t.
The Fig-4 & Fig-5 shows the script written in powershell to detect pending reboot.
how can we put this function in loop to go through all windows servers in Active directory ? then get the result in list
thank you