Lets say you have a couple hundred servers to look over and after a “patch Tuesday” you know your WSUS server has already sent out the updates and each computer has installed it. Now you need to know who has a reboot pending. Well, here’s the script to create the reboot list.
REM ~~~~~ Looking for Pending Reboots ~~~~~ @echo off del c:\pstools\results\pendingreboots.txt For /F %%w in (allservers.txt) do ( echo %%w echo %%w >>c:\pstools\results\pendingreboots.txt reg query "\\%%w\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" /v PendingFileRenameOperations >>c:\pstools\results\pendingreboots.txt echo --------------------------------------------------------- >>c:\pstools\results\pendingreboots.txt )
What this will do is create a file that looks like this.
Computer1 --------------------------------------------------------- Computer2 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager PendingFileRenameOperations REG_MULTI_SZ \??\C:\WINDOWS\system32\_000123_.tmp.dll\0\??\C:\WINDOWS\system32\SET15.tmp\0!\??\C:\WINDOWS\system32\crypt32.dll --------------------------------------------------------- Computer3 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager PendingFileRenameOperations REG_MULTI_SZ \??\C:\WINDOWS\system32\SET6CA.tmp\0!\??\C:\WINDOWS\system32\wininet.dll\0\??\C:\WINDOWS\system32\SET73F.tmp\0!\??\C:\WINDOWS\system32\urlmon.dll\0\??\C:\WINDOWS\system32\SET784.tmp\0!\??\C:\WINDOWS\system32\url.dll\0\??\C:\WINDOWS\system32\SET7C9.tmp\0!\??\C:\WINDOWS\system32\occache.dll\0\??\C:\WINDOWS\system32\SET9D5.tmp\0!\??\C:\WINDOWS\system32\msfeedsbs.dll\0\??\C:\WINDOWS\system32\SETA0A.tmp\0!\??\C:\WINDOWS\system32\msfeeds.dll\0\??\C:\WINDOWS\system32\SETAD2.tmp\0!\??\C:\WINDOWS\system32\iertutil.dll\0\??\C:\WINDOWS\system32\SETBBC.tmp\0!\??\C:\WINDOWS\system32\ieframe.dll\0\??\C:\WINDOWS\system32\SET1CB2.tmp\0!\??\C:\WINDOWS\system32\win32k.sys\0\??\C:\WINDOWS\system32\SET1D03.tmp\0!\??\C:\WINDOWS\system32\gdi32.dll\0\??\C:\WINDOWS\system32\_000115_.tmp.dll\0\??\C:\WINDOWS\system32\SET2520.tmp\0!\??\C:\WINDOWS\system32\crypt32.dll ---------------------------------------------------------
Looking at these results, we can see that Computer1 is ok, but computer2, and computer3 need a reboot.
Hope this helps!