The kludgy solution
Since I have found no way to force the registry changes to disk, I do the opposite:
Wait until the key is saved.
code:
WaitHKLM()
; Do the reboot
Return
Function WaitHKLM()
; Wait until HKLM is saved to disk, on Win9x systems
; HKLM is saved to the file %WinDir%\System.dat
$RegistryKey = 'HKLM\Software\MyCompany'
$SysFile = %WinDir% + '\System.dat'
$OldTime = @Date + ' ' + @Time
$Test = '' + ReadValue($RegistryKey,'REG-Test')
If $Test = '1'
$RC = WriteValue($RegistryKey,'REG-Test','0','REG_SZ')
Else
$RC = WriteValue($RegistryKey,'REG-Test','1','REG_SZ')
EndIf
Do
$NewTime = '' + GetFileTime($SysFile)
Sleep 5
Until $NewTime > $OldTime
EndFunction
This can cause a pause of about 1 - 5 minutes. But i can be sure that the registry is saved to disk.
Should take care of the 'fast' users, who hits the power/reset button as soon as they see the 'Shutting down windows' message on the screen.
Jack,
Like you I have given up in finding whitch programs/upgrades causes the reboot process to fail.
But my experiance from this, is that some of my users are to impatiente.
-Erik