This script, when run against a Windows server, will execute a 'reg query' against HKLM\SYSTEM\CurrentControlSet\Control\Session Manager and will check the registry for the PendingFileRenameOperations key. Depending on the result, the script will set the NEEDS_REBOOT server property.

When scheduled to run on a daily basis, you can create a Smart Server Group of all your Windows servers that need to be rebooted.

NOTE: I have also attached the same script but for use with versions 7.x of Configuration Manager. Be sure to download the correct version.

Updated Mar 13, 2007 - Version 1.3 uploaded to include checks for other areas of the registry where Windows may set reboot state.