Page 1 of 1 1
Topic Options
#73116 - 2003-02-14 09:01 PM Q - Force a save all before restarting Win9x
kholm Offline
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’ [Wink] , 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
#73117 - 2003-02-14 11:04 PM Re: Q - Force a save all before restarting Win9x
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Registry writes are immediate. How do you change the settings? If it is during the login, then you might need to wait until the registry is loaded completely. This is docunented in the FAQ Forum.
_________________________
There are two types of vessels, submarines and targets.

Top
#73118 - 2003-02-14 11:19 PM Re: Q - Force a save all before restarting Win9x
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
you could introduce your own delay in the KiX scriptbetween where you write to the reg and where you restart.

Or better still, don't hack the reg for IP setting but let DHCP do it instead.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#73119 - 2003-02-14 11:42 PM Re: Q - Force a save all before restarting Win9x
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Writes to the registry are relatively fast. Either you are not writing to where you think you are or there is somthing wrong with the setup of the problem machines. Another possibility is your reboot command.

Why not show the command & how you are inserting it into the registry. Also, could you show how you are editing the IP info?
_________________________
Jack

Top
#73120 - 2003-02-15 06:11 PM Re: Q - Force a save all before restarting Win9x
kholm Offline
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 [Wink] )
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 Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#73122 - 2003-02-15 06:42 PM Re: Q - Force a save all before restarting Win9x
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
It is probably the side effect of the particular method you are using to reboot/restart. I know that when it comes to Wintendos, shutdown/reboot is more of a mystic art than an exact science. With all the different flavors of Wintendos, the different methodologies have differing results.

I would look to using a different method. Unfortunately I can't suggest any one particular method over another as in my environment when I did have a lot of Wintendos, they were all the same cloned build. Alas they are almost all gone now. [Big Grin]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#73123 - 2003-02-16 04:56 PM Re: Q - Force a save all before restarting Win9x
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Thanks for your suggestions!

Your suggestions could narrow my problems down to the restart procedure. Maybe i should look deeper into the different rundll,, methods, i have avoided those because of the diffent calls for 95/98/Me

This is part of a greater projekt where we upgrade from fixed IP-adds no DNS no DNS to DHCP partly using DNS/WINS. All this to be able to upgrade the domain to an AD-doamin (And all workstations to XP).

-Erik

Top
#73124 - 2003-02-17 05:15 AM Re: Q - Force a save all before restarting Win9x
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
I have not been able to pin it down to extactly which patch is doing it but certain upgrade/patch sequences in Win98 seem to break the shutdown/reboot process in several of our test machines. My personal opinion is it has to do with the IE6 updates but there are several MS tecknotes suggesting that the problem might be in the large disk patchs. My strategy is to minimize updates.

Our experience is that these machines freeze during reboots which requires the user to hit the reset switch. Maybe this is what you are seeing.

You might try experimenting with some of the various shutdown utilities to see if that addresses the problem.

Also, you might try doing a sleep step & then another action after the registry update (maybe try reading what you wrote) & then rebooting. This might help understand what is happening.

[ 17. February 2003, 05:20: Message edited by: Jack Lothian ]
_________________________
Jack

Top
#73125 - 2003-02-17 06:55 PM Re: Q - Force a save all before restarting Win9x
kholm Offline
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
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.129 seconds in which 0.075 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org