Jump to content

rebooting twice automatically?


Recommended Posts

Hey all. I current have an unattended setup for Windows 2000, which has IE6 SP1 installing automatically through cmdlines.txt. It works properly, but doesn't play well with other windows updates until it finished configuring. So for example if I deploy the machine and it gets updates automatically before logging in (through software update services), I have problems logging in and opening control panel etc.

Anyways, the solution of this is to log in *twice* after the image is complete ... the first time configures a profile, and then the second time is when the IE6 setup goes through and does it's little setup immediately after logging in. If I were performing this setup on a machine that had already logged in, it'd perform the setyup immediately following the next reboot/login ... but doesn't appear to be the case here.

Long story short, I simply want to make this thing reboot twice, and I'm not quite sure how to accomplish this. I have it set to autologin twice ... and have a guirunonce command that forces the first reboot.

I tried creating a registry key that creates a single run entry (to force the reboot on next login) and having that imported as part of the guirunonce, but that gets run immediately after, so that won't work.

anyone got any ideas? I did a quick search but couldn't find any info.

Link to comment
Share on other sites


have the shutdown command loaded into the RunOnceEX

something with this below - don't have the syntax readily available. But this is what gets run when the user logs on. So the guirunonce will add the command and then shutdown the first time.

reg add hklm\software\microsoft\windows\currentversion\runonceex

Of course a simple shutdown and cleanup batch file dumped into the startup folder works too. Have the batch initiate shutdown.exe and then have it delete the batch file.

Link to comment
Share on other sites

have the shutdown command loaded into the RunOnceEX

something with this  below - don't have the syntax readily available.  But this is what gets run when the user logs on.  So the guirunonce will add the command and then shutdown the first time.

reg add hklm\software\microsoft\windows\currentversion\runonceex

Of course a simple shutdown and cleanup batch file dumped into the startup folder works too.  Have the batch initiate shutdown.exe and then have it delete the batch file.

Sorry, I'm no pro with the syntax of these commands. If I wanted to add the following batch file to the runonceex section, what should I put in GuiRunOnce?

\\knxw2ks-ris01\Installs\Scripts\restart2.bat

Thanks :)

Link to comment
Share on other sites

have your first batch file copy the file RESTART2.bat to the following location - %userprofile%\Start Menu\Programs\Startup\

make restart2.bat like this below. Adjust shutdown time to as long or short as required - (untested)

CLS
@echo off
TITLE Windows 2000 - Second Shutdown
ECHO.
ECHO Restarting the PC in 1 minute...
shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"
del "%userprofile%\Start Menu\Programs\Startup\restart2.bat"

oh wait - you got win2000 - not sure if this will work at all - shutdown.exe is a winXP thing

Link to comment
Share on other sites

have your first batch file copy the file RESTART2.bat to the following location - %userprofile%\Start Menu\Programs\Startup\

make restart2.bat like this below.  Adjust shutdown time to as long or short as required - (untested)

CLS
@echo off
TITLE Windows 2000 - Second Shutdown
ECHO.
ECHO Restarting the PC in 1 minute...
shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"
del "%userprofile%\Start Menu\Programs\Startup\restart2.bat"

oh wait - you got win2000 - not sure if this will work at all - shutdown.exe is a winXP thing

don't worry about shutdown.exe, I've got that included in all windows 2000 systems.

What would help me the most are two things:

a list of what executes in what order during startup. for example, what order does guirunonce, runonce, runonceex, run, and the startup folder in a user profile execute in?

Also, I need to know the syntax for adding a registry key to execute a file from a certain location. For example, if I add a command to execute restart2.bat to the registry and then export it, I get this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"Reboot"="\"\\\\knxw2ks-ris01\\Installs\\Scripts\\restart2.bat\""

So basically, I need to know how to do that with a reg add command, but I don't know how.

the simplest solution for me is knowing in what order the startup items execute them in. So for example, if they execute in order A B C D, then I can have D run and place an entry in A, B, or C without worrying about it running again until the next reboot.

Thanks!

Link to comment
Share on other sites

I suggest to read my topic here :

Removing Internet Connection Wizard from Windows 2000 Professional deployments :

It shows a sample batch file to add values in registry key

for your IE6SP1 install through cmdlines.txt, you should try to run my iernonce.cmd

just after the IE install :

sample cmdlines.txt

[commands] 
".\inst_IE6.cmd""
".\iernonce.cmd"

inst_IE6.cmd executes IE6SETUP.EXE /C:"IE6WZD /S:""#e"" /Q:A /R:N"

iernonce.cmd executes IE6SETUP.EXE added keys in Registry RunOnceEx

GreenMachine uses this method when integrating IE6 installation via SVCPACK

2KCREATE by GreenMachine

Link to comment
Share on other sites

  • 1 year later...

I ran into the same problem a few years back too. How about this:

1. Increase your "AutoLogonCount" from your unattended.txt file by one. For example, if you have AutoLogonCount=1, then set it to AutoLogonCount=2. You want Windows to reboot one more time.

[GuiUnattended]

AutoLogon=Yes

AutoLogonCount=2

2. Add "RunOnce.cmd" to your cmdlines.txt.

[commands]

"RunOnce.cmd"

3. Create a "RunOnce.cmd" file with these codes:

You need CMDOW.EXE. Add it to your $$\System32 folder. Omit the "CMDOW @ /HID" line if you don't have it. It hides the DOS prompt. The code is really short, so you might not even need it.

---------------------------- start of batch file --------------------------

CMDOW @ /HID

SET KEY="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

REG ADD %KEY%\001 /VE /D "Internet Explorer 6" /F

REG ADD %KEY%\001 /V 1 /D "%systemdrive%\YOUR IE6 FOLDER PATH\ie6setup.exe /Q:A /R:S" /F

REG ADD %KEY%\802 /V 1 /D "Shutdown.exe /L /R /T:00 /Y" /F

EXIT

----------------------------- end of batch file ---------------------------

The REG.EXE command above is from Windows XP. It's different on Widows 2000. You can always (I recommend it) copy the REG.EXE from an XP machine onto your Windows 2000 machine (into your $$\System32 folder, otherwise you must change the commands above to match the Windows 2000 version. I use the REG.EXE from the Windows XP because it has more options and my script can be ported over to an XP machine later on without re-coding. My company is still using Windows 2000.

The last line of the batch file is the most important one for you. The number %KEY%\802 is not coincidental. If you have more commands to add to the batch file, it needs to be higher than 802 (ex 803, 804, 910, etc..). Internet Explorer adds a few lines of codes to the RunOnceEx after it installs itself up to the 801 number.

By the way... you need to update the "%systemdrive%\YOUR IE6 FOLDER PATH\ie6setup.exe /Q:A /R:S. Replace the "YOUR IE6 FOLDER PATH" with the correct path. Good luck.

SYSTEM32.zip

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...