#73116 - 2003-02-14 09:01 PM
Q - Force a save all before restarting Win9x
|
kholm
Korg Regular
   
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
How can i force a Win9x workstation to save all settings before restartingt ??
Restarting, meaning I force the workstation to restart from a run key in HKLM, after the setting are changed!
I am changing the IP settings on all my net clients. BUT - on some of the Win9x systems, the changes i make to the registry are not saved.
I have a suspition that this is caused by users with no patiance (If the computer says restarting, and it dosn’t restart within 10 seconds, they cut the power).
In the ’good old days – Win 3.x’ , you could force diskwrites using smartdrv /d
If this is not build into Win9x, I would appreciate any hints to programing this in VB or using COM
-Erik
ps. I just skimmed the NT4 resource kit for other posiblities. Suprice: The author of several tools are Ruud van Velsen [ 14. February 2003, 21:17: Message edited by: kholm ]
|
|
Top
|
|
|
|
#73120 - 2003-02-15 06:11 PM
Re: Q - Force a save all before restarting Win9x
|
kholm
Korg Regular
   
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
Some more info:
The script that change the IP settings is run after logon from a run key in HKLM It only operates on values in HKLM
Jens, Writes to the registry is immediated: Yes, but i belive that my problems comes from all diskbufferes are not written to disk before ore during shutdown.
Les, DHCP is not an option, because i’m actually changing the IP settings on the clients to use DHCP, they have been using fixed adresses until now. (What came first the hen or the egg ) I have tryed to pause the script for 30 seconds. I even tried shelling out to import a dummy .reg file using regedit before doing the restart
Jack, Same restart procedure, and same script on all clients. You are surely right in something is wrong on the setup on the clients. The restart could be the problem, i wil dig into this, it is done by an external program.
I know that all my writes to the registry are lost, because the script starts with reading/writing to a private key/value to decide if it has to be run, if the value exists the script won’t run again, this value is also not saved! The puzzle is that this only happens on about 1 out of 10 Win9x clients.
My last desparate though is to let the the script make a small install of a program, like the windows installer, even if it is installed before. But why bother the 9 out of 10 clients that works with no problems?
What i would really like to do is to flush all disk buffers before i execute the restart command.
-Erik
|
|
Top
|
|
|
|
#73121 - 2003-02-15 06:37 PM
Re: Q - Force a save all before restarting Win9x
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Are you looping through all the transport keys? Could the computer have more than one transport such as RAS? code:
:Loop1 $KeyName = ENUMKEY( "$HKLM\Class\NetTrans\" , $Index ) $RC = @ERROR $DHCPEnabled=ReadValue("$HKLM\Class\NetTrans\$KeyName","IPAddress") $Index = $Index + 1 If $RC = 0 If $DHCPEnabled="0.0.0.0" $DHCPEnabled=1 Else $DHCPEnabled=0 Endif If $DHCPEnabled = 1 ; Check DHCP Settings $ReturnCode = WRITEVALUE( "$HKLM\Class\NetTrans\$KeyName" , "IPAddress" , "0.0.0.0" , "REG_SZ") $ReturnCode = WRITEVALUE( "$HKLM\Class\NetTrans\$KeyName" , "IPMask" , "0.0.0.0" , "REG_SZ") $ReturnCode = DELVALUE( "$HKLM\Class\NetTrans\$KeyName" , "DefaultGateway") Endif goto Loop1
The code above is very old and may not be completely functional.
|
|
Top
|
|
|
|
#73125 - 2003-02-17 06:55 PM
Re: Q - Force a save all before restarting Win9x
|
kholm
Korg Regular
   
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
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
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|