Making AddOns run on a 2nd RunOnce Login

Questions or comments on the switchless installers? Want to create a new one? Talk about it here.
Post Reply
jfcarbel
Posts: 158
Joined: Tue Apr 15, 2008 2:08 am

Making AddOns run on a 2nd RunOnce Login

Post by jfcarbel » Fri Jan 08, 2010 2:30 am

I have the need to let the user_hidden .NET AIO RunOnce AddOn that runs at RunOnce complete and then force it to reboot and run the next set of RunOnce installs.

I know how to add RunOnce stuff via cmdlines.txt via the registry. But how to I make it so that one runs first, finishes, and then have the rest install on a 2nd reboot and login.

Need to do this since HandBrake requires .NET 2.0 to be installed first.

Kurt_Aust
Posts: 100
Joined: Fri Jul 25, 2008 6:23 pm
Location: Sydney, Australia

Post by Kurt_Aust » Fri Jan 08, 2010 4:36 pm

This topic should give you some ideas of how to launch multiple install passes using batch files, but note there are some changes required re 32-bit XP.

jfcarbel
Posts: 158
Joined: Tue Apr 15, 2008 2:08 am

Post by jfcarbel » Fri Jan 08, 2010 7:24 pm

Ok, looked over that long post, saw the 4 different sections, but not sure how these get run in batches. How is each BAT file for each run kicked off and how is it made sure that one does not run until it fully completes.

Kurt_Aust
Posts: 100
Joined: Fri Jul 25, 2008 6:23 pm
Location: Sydney, Australia

Post by Kurt_Aust » Fri Jan 08, 2010 10:41 pm

The first batch file gets called from nLite's RunOnce and then they call each other in succession. Here's the short version with all the fluff cut out:

[*] Unattended settings, this is the most important one. Your RunOnce file should look like this:

Code: Select all

TimeOut /T 40
CMD /R %Source%Run1_XP-64.bat
You should also set it to autologon twice to an administrator class account (read the note), fully automated mode would be an excellent idea Smithers. The TimeOut is to avoid a "Device not Ready" error. If you need to load drivers from a floppy then read the note on the general tab about OEM Preinstall.

Run1_XP-64.bat

Code: Select all

rem silent installers go here

rem initialise account, setup for second pass
Start %Source%RunOnce\AccountInit.bat %Source%

AccountInit.bat

Code: Select all

TimeOut /T 180
If exist %1Run2_XP-64.bat REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce /V command0 /D "%1Run2_XP-64.bat %1 "
ShutDown /R /F /T 20

Run2_XP-64.bat

Code: Select all

rem startup delay to allow disk thrashing to subside before proceeding
TimeOut /T 120

rem you must use either %Source% or %1 when referring to files on the install media
Set Source=%1

rem silent installers go here

rem setup for the next pass
If exist %Source%Run3_XP-64.bat REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce /V command0 /D "%Source%Run3_XP-64.bat %Source% "

ShutDown /R /F /T 20

Run3_XP-64.bat

Code: Select all

rem startup delay to allow disk thrashing to subside before proceeding
TimeOut /T 120

rem you must use either %Source% or %1 when referring to files on the install media
Set Source=%1

rem silent installers go here

rem setup for the next pass
If exist %Source%Run4_XP-64.bat REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce /V command0 /D "%Source%Run4_XP-64.bat %Source% "

ShutDown /R /F /T 20
and so on forever.

jfcarbel
Posts: 158
Joined: Tue Apr 15, 2008 2:08 am

Post by jfcarbel » Sat Jan 09, 2010 12:18 am

Got it, each one adds a key so it knows what is next to run and does shutdown after each one.

And for 32-bit XP instead of Timeout cmdline, use:
Ping -n x+1 127.0.0.1 > nul

I will give this a go tommorrow.

I am using user_hidden AIO .NET AddOn, and it adds install to runonce I think by using INF commands. So I think I would need to strip out the runonce stuff from INF and add it to my batch files so that I can control order.

jfcarbel
Posts: 158
Joined: Tue Apr 15, 2008 2:08 am

Post by jfcarbel » Sun Jan 10, 2010 7:56 am

Okay so here in the user_hidden INF file for his AIO .NET that runs at ROE.
[Version]
signature="$Windows NT$"

[Optional Components]
Dotnet Framework

[Dotnet Framework]
OptionDesc = "Microsoft dotNet Framework 3.5 SP1"
Tip = "Microsoft dotNet Framework 3.5 SP1"
Modes = 0,1,2,3
AddReg = Base.DF.RunOnceEx

[DefaultInstall]
RunPreSetupCommands=DF:1
SmartReboot=N

[Base.DF.RunOnceEx]
HKLM,"%KEY_WIN_CURVER%\RunOnceEx\Setup","DF",,"%11%\reg.exe ADD ""HKLM\%KEY_WIN_CURVER%\RunonceEx\DF Setup"" /v DFInstall /t reg_sz /d ""RUNDLL32 advpack.dll,LaunchINFSection net35.inf,DefaultInstall"" /f"

[DF]
; Used during install
;"%10%\net35.exe -ai" ;Silent Unattended
"%10%\net35.exe -ai1" ;Passive Unattended
;"%10%\net35.exe -ai2" ;Silent w/KB963707 WU/MU nag fix
;"%10%\net35.exe -ai3" ;Passive w/KB963707 WU/MU nag fix

; Used during Cleanup
"%11%\cmd.exe /Q /C DEL %10%\net35.exe /Q/F"

[Strings]
KEY_WIN_CURVER = "Software\Microsoft\Windows\CurrentVersion"
Now here is how I understand that it works:

1. When AddOn INF runs all it does is Add the below registry entry:

Software\Microsoft\Windows\CurrentVersion\\RunonceEx\DF Setup
RUNDLL32 advpack.dll,LaunchINFSection net35.inf,DefaultInstall

2. Then upon 1st reboot with login, it executes the RunOnce registry entry which is like doing a right click on the INF and selecting install and thus running the DefaultInstall section which then kicks off the net35.exe installer with -ai1 parms

Not sure how it knows to kick off that cleanup cmd in the INF only when .NET finishes.

Now here is what I do not know how to do. How is it that I can allow this .NET installer to complete and then only when its completely done, force a reboot. I know the command to do the reboot, I just do not know where to put it so that it only executes after this installer for .NET is completed. And if the best place for this shutdown to control its timing is in this .NET AddOn INF, then ho would I add the shutdown cmd that I see in the batch files to an INF

Can someone help me here?

User avatar
5eraph
Site Admin
Posts: 4621
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Sun Jan 10, 2010 8:37 am

By default, commands given in a RunPreSetupCommands directive will execute in sequence upon completion of previous commands unless a flag of 2 or 3 is specified (3 = flags 1 + 2).

If you want to add the shutdown command to the INF then place the following line after the cleanup command.

Code: Select all

"""%11%\ShutDown.exe"" /R /F /T 20"
Or, you can change the SmartReboot directive from N to AS instead of using the above command. :)

Post Reply