WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Reboot and Shutdown Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Detect Windows Reboot Needed

Keywords:  Detect Windows Reboot Needed

Question:

After installing software silently, with all reboots suppressed, there is a way to detect that the system has been marked for reboot. Does anyone know how to detect this using WIL.

Answer:

The list of files to be updated is stored in the registry.

Here's the magic key:

If RegExistValue(@RegMachine,"System\CurrentControlSet\Control\Session Manager[PendingFileRenameOperations]") Then *RebootRequired*

If the above does not exist, do the following:

In 95/98/ME check for the existence of the file wininit.ini in the windows directory. (There is probably a wininit.bak from a previous reboot there)

In Windows NT/2000/XP I don't think there is a flag persay that you can check, however most of the time the reason for the reboot is so that system files can be updated.

The list of files to be updated is stored someplace in the registry. If you can find the spot in the registry where the files are stored...then you can look there.

....

To find it...

  1. Make two files
    C:\temp\aaa.txt
    and
    c:\temp\bbb.txt
    
    contents do not matter.

  2. Run this script. DO NOT press OK
    handle=FileOpen("C:\temp\aaa.txt","READ")
    Message("TESTING","DO NOT PRESS OK")
    FileCLose(handle)
    
  3. Now run this script...
    IntControl(30,"c:\temp\bbb.txt","c:\temp\aaa.txt",0,0)
    
  4. Now you can press the OK button from step 2

  5. Now search the registry for aaa.txt and see where it shows up. And figure out how the delayed file move from IntControl 30 works.

Article ID:   W15276
File Created: 2002:09:05:13:50:56
Last Updated: 2002:09:05:13:50:56