- Prerequisites for this tutorial:
- This tutorial briefly covers all of the following steps necessary for RunOnceEx (ROE) to function using this method:
- Editing an existing WINNT.SIF file.
- Creation of a cmdlines.txt file.
- Creation of a RunOnceEx.cmd file.
- Use of the $OEM$ distribution folders.
- Optional (but highly recommended) knowledge that will not be explicitly covered:
- The setup and use of virtual machines to test your ISOs. Please visit the following thread for the discussion of preferred VM software.
- What this tutorial will NOT cover:
- When or why you should use RunOnceEx as opposed to other methods of installation.
- Creation of a completely unattended WINNT.SIF file. Please refer to the resources in DEPLOY.CAB on your WinXP Pro source CD or MSFN's Unattended Windows Guide. Or use nLite.
- The use of nLite. It has its own documentation and forum.
- Windows Post-Installation Wizard (WPIW). It has its own documentation and subforum on this site.
- Creation of installers or addons. Many resources can be found elsewhere on this site in the appropriate forums; too many to link in this small space.
- Switches necessary for certain installers. This has been discussed already with many useful links.
- Creating or burning bootable ISOs.
- When I first tried following MSFN's guide back in 2005, this is the single step that completely buggered me. It's still not listed, and it's absolutely necessary.
Make certain the following lines are present in your WINNT.SIF file. The file should be located in I386, or AMD64 if your source is x64, if you have one. Without these lines your $OEM$ distribution folders will fail to copy during Windows setup and ROE will fail.
The lines above can be used as shown to enable this method of RunOnceEx without any other unattended settings, if desired. Please refer to REF.CHM in DEPLOY.CAB or MSFN's WINNT.SIF Reference for more information.
Code: Select all
- Alanoll provides a clear explanation of this file, if you're interested in reading it.
Create a file named cmdlines.txt in the $OEM$ folder. For our purposes, we'll only be concerned with adding the following two lines to the file:
Save and exit.
Code: Select all
- This file is used to add our installer commandlines to the registry for execution at first logon. If you've been comparing this tutorial to MSFN's so far then you'll notice that cmdow is conspicuously absent in the example file shown below. This is due to the fact that most antivirus applications will flag cmdow.exe as a potential threat. I won't go into why in this tutorial. The choice is yours whether to include cmdow or not. This tutorial will not.
I'll use the following example to explain how to build this file. Code in color will be explained below.
SET KEY - All registry entries in this file will be applied to this key. Setting KEY as an environment variable allows us to use much shorter REG commands with %KEY%.
Code: Select all
[color=orange]SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx[/color] REG ADD [color=orange]%KEY%[/color] /V Title /D "Post-Setup Installation" /f REG ADD [color=orange]%KEY%[/color]\[color=yellow]05[/color] /VE /D "Microsoft .NET Framework 3.0" /f REG ADD [color=orange]%KEY%[/color]\[color=yellow]05[/color] /V [color=cyan]1[/color] /D "%SystemDrive%\Install\dotNET30.exe" /f REG ADD [color=orange]%KEY%[/color]\[color=yellow]10[/color] /VE /D "Windows Live Messenger 8.1.178 (MessPatched)" /f REG ADD [color=orange]%KEY%[/color]\[color=yellow]10[/color] /V [color=cyan]1[/color] /D "%SystemDrive%\Install\LiveMess.exe" /f REG ADD [color=orange]%KEY%[/color]\[color=yellow]10[/color] /V [color=cyan]2[/color] /D "REGEDIT /S %systemdrive%\Install\messtweaks.reg" /f REG ADD [color=orange]%KEY%[/color]\[color=yellow]20[/color] /VE /D "Messenger Plus! Live v184.108.40.2066" /f REG ADD [color=orange]%KEY%[/color]\[color=yellow]20[/color] /V [color=cyan]1[/color] /D "%SystemDrive%\Install\MsgPlusLive-423.exe /silent" /f [color=violet]REG ADD %KEY%\99 /VE /D "Cleanup" /f REG ADD %KEY%\99 /V 1 /D "%SYSTEMDRIVE%\Install\HideC.exe %SYSTEMDRIVE%\Install\Cleanup.cmd" /f[/color]
ROE number - These values determine the execution order. Letters and numbers can be used here, but be aware that the entire string is evaluated, not the intended number. For example, the following values will be executed in the order given: 05, 10, 6, 65, A1, A2, AA, ZZ. Use leading zeros when necessary as shown in the example above.
multiple steps - For each installation, several steps can be used. The order is determined with the same rules as the ROE numbers above.
Cleanup - This step is optional, but recommended for use in all installations.
For encapsulated quotes, what to use in your Cleanup.cmd, and other RunOnceEx.cmd details please refer to MSFN's guide. HideC.exe (A.K.A. RunHiddenConsole.exe) can be found on MSFN.
- I can't explain them much better than Alanoll, so I won't. Please refer to his guide for the proper layout the folders must have, paying particular attention to I386, $OEM$, $1, and Install. All of your ROE installers should be placed in the Install folder. RunOnceEx.cmd and cmdlines.txt should be located in $OEM$. WINNT.SIF should be in I386 unless your source is x64. Any deviation from what's given will cause ROE to fail.
- [2010/08/27 22:30 UTC] - v1.03 - Updated MSFN forum links. Apparently, some link formats cost money to use. Free links that should always work are now used.
- [2008/05/20 03:30 UTC] - v1.02 - Updated links to DEPLOY.CAB from SP2 version to SP3 version.
- [2008/04/06 22:50 UTC] - v1.01 - Corrected discrepancies, added a link to step 1, and included a link to HideC.exe on MSFN.
- [2008/04/06 21:40 UTC] - v1.00 - Initial posting.