Jump to content

How I use nLite...


nwarren

Recommended Posts

I've been using nLite for a couple of years now, and thought I'd mention how I've adapted my use of it to make building multiple nLite'd CDs rather more simple...

The basic process uses a batch file to do the following steps - I'll use XP32 as my example, but this works for XP64 and all versions of W2K3:

  • Create a new 'source' XP folder from a set of master folders (updates/refreshes folder if it already exists)
  • Copy additional files for $OEM$ folder to source folder
  • Copy specific build settings files from build settings folder to nlite\presets folder
  • Run nLite
  • Copy updated settings files back to build settings folder (saves them for next time!)
  • Build ISO

With my process I've found that I can build an increasingly customised version of XP always being able to revert back to the last version if something goes wrong.

A few more details:

Naming scheme - this is incredibly important as it makes it much more simple. For example, to create a build of Windows XP Pro, SP2, volume license key for my work PC I create and run a batch file called work.wxpp.sp2.vlk.b1.cmd. For Windows Server 2003, I might use work.w2k3.r2ee.vlk.b1.cmd (R2 Entrerprise Edition).

I use b1, b2 etc to denote my 'production builds' and z1, z2 etc to denote my 'in development builds'.

The contents of this WXPP batch file are as follows:

------

@echo off

bin\nlite.cmd %~n0 wxpp.sp2.vlk $OEM$.work

------

nlite.cmd is the main batch file that does all the hardwork. %~n0 returns the file name (no extension) of the running batch file. wxpp.sp2.vlk is the folder name of the Windows source. $OEM$.work is the folder name of any extra files I want to copy down to the build CD.

The contents of the nlite.cmd file are:

------

@echo off

set source=\u9.windows.org.disks\%2

set target=\u99.tmp\%1

rem set robocopy variables...

set rcopy=bin\robocopy.exe

set rcparams=/zb /r:3 /w:3

rem goto makecd

rem copy o/s source files to tmp build folder...

%rcopy% %source% %target% %rcparams% /mir /XD docs dotnetfx support valueadd

rem copy $OEM$ files to tmp build folder...

if "%3"=="" goto nLiteSettings

%rcopy% %3 %target%\$OEM$ %rcparams% /s

:nLiteSettings

rem copy build settings to master nLite settings folder

if exist "nlite\presets\last session (*.ini" del "nlite\presets\last session (*.ini"

copy "settings\%1%.nlite.ini" "nlite\nlite.ini"

copy "settings\%1%.last session.ini" "nlite\presets\last session.ini"

copy "settings\%1%.last session_u.ini" "nlite\presets\last session_u.ini"

rem run nLite

start/wait nlite\nlite.exe

rem copy modified build settings from master nLite settings folder

copy "nlite\nlite.ini" "settings\%1%.nlite.ini"

copy "nlite\presets\last session.ini" "settings\%1%.last session.ini"

copy "nlite\presets\last session_u.ini" "settings\%1%.last session_u.ini"

rem copy version info to root of build CD...

%rcopy% .\ %target% /if "build specs.doc" %rcparams%

%rcopy% .\ %target%\$OEM$\$1 /if "build specs.doc" %rcparams%

echo Build Version is %1 > %target%\#%1.txt

echo Build Version is %1 > %target%\$OEM$\$1\#%1.txt

:makecd

rem make ISO...

bin\cdimage.exe -bbin\boot.bin -o -m -h -n -l %target% \u0.final.disk.iso\%1.iso

------

It's probably worth discussing my folder structure at this stage. I've designed this so that all the temporary files and final ISOs are separated from the main 'data' files which makes backing up a little more straightforward!

\u0.final.disk.iso (holds the final ISO build files)

\u2.nlite (holds the build batch files and various sub-folders)

-- home.wxph.sp2.oem.b1.cmd (home build for XP Home, SP2, OEM edition)

-- work.wxpp.sp2.vlk.b1.cmd (work build for XP Pro, SP2, volume license edition)

-- work.wxpp.sp2.vlk.z1.cmd (test build for XP Pro, SP2, volume license edition)

-- work.wxpp.sp2.vlk.z2.cmd (test build for XP Pro, SP2, volume license edition)

-- work.wxpp.sp2.vlk.z3.cmd (test build for XP Pro, SP2, volume license edition)

-- work.wxpp.sp2.vlk.z4.cmd (test build for XP Pro, SP2, volume license edition)

--\$OEM$.nick ($OEM$ folder for my personal builds)

----\$1

------\common ('common' folder that is copied to the root of %SystemDrive% - holds various files I use on every PC)

--\$OEM$.work ($OEM$ folder for my work builds)

--\bin (folder that contains files relevant to this semi-automated build process)

---- boot.bin (floppy boot image file needed to create bootable CD)

---- cdimage.exe (executable for creating bootable CD)

---- nlite.cmd (batch file listed above)

---- robocopy.exe (used to do the various bits of file copying)

--\nlite (extracted files for nLite application)

----nlite.ini (application settings file - this is updated/replaced by my process)

----\Lang (standard nLite sub-folder)

----\Presets (standard nLite sub-folder - this is where most of the settings are stored )

------Last Session.ini (first build settings file - this is updated/replaced by my process)

------Last Session_u.ini (second build settings file - this is updated/replaced by my process)

--\settings (folder that contains all my 'master' settings files)

----work.wxpp.sp2.vlk.b1.Last Session.ini

----work.wxpp.sp2.vlk.b1.Last Session_u.ini

----work.wxpp.sp2.vlk.b1.nlite.ini

----home.wxph.sp2.vlk.b1.Last Session.ini

----home.wxph.sp2.vlk.b1.Last Session_u.ini

----home.wxph.sp2.vlk.b1.nlite.ini

----work.wxpp.sp2.vlk.z1.Last Session.ini

----work.wxpp.sp2.vlk.z1.Last Session_u.ini

----work.wxpp.sp2.vlk.z1.nlite.ini

\u9.drivers (folder containing drivers to be integrated using nLite)

--\XP32 (drivers for 32bit version of XP)

--\XP64 (drivers for 64bit version of XP)

\u9.addonpacks (any addonpacks to be integrated during nLite build)

\u9.updatepacks (any RyanVM updatepacks to be integrated during nLite build)

\u9.windows.org.disks (folder containing extracted ISOs of original Windows installations)

--\wxph.sp2.oem

--\wxph.sp2.retail

--\wxpp.sp2.vlk

--\wxpp64.sp2.vlk

--\w2k3.r2ee.vlk

--\w2k3.r2se.vlk

\u9.tmp (folder for containing all temoporary files created as part of the build process)

So as you can see, for data back up purposes, the only folder that 'needs' to be backed up is the \u2.nlite folder

So what actually happens...section by section through the batch process:

  • create a variable called 'source' pointing to the correct Windows version folder in the \u9.windows.org.disks folder - in this case it would be \u9.windows.org.disks\wxpp.sp2.vlk
  • create a variable called 'target' pointing to a temp 'build' folder - in this case it would be \u9.tmp\work.wxpp.sp2.vlk.b1
  • set up the robocopy variables including standard parameters
  • Copy the Windows installation files from source to target - using '/mir' in Robocopy creates an image, so that if the target folder already exists, Robocopy returns it to being an exact mirror image of the source folder - when constantly rebuilding a particular build number, this can save several minutes over copying the entire Windows folder afresh.
  • Copy the the $OEM$ files to the target folder
  • Remove all old nLite settings files from the Presets folder - this is optional but just keeps it tidy!
  • Copy the specific nLite settings files for the build to the Presets folder (if they exist - if it's a new build number, this does nothing)
  • Run nLite, holding this batch file open until it completes
  • After nLite has finished customising the target folder, copy the settings files back to the master store, naming them according to the full build title
  • Copy some build version info to the root of the build CD - I have a build specs doc that lists detailed info about each of my builds
  • Build the ISO - using cdimage.exe I cna build the ISO with the right build name in the u0.final.disk.iso folder. nLite can build the ISO as well, but then the batch file would have to find the file, move and rename it.

So the end result of all of this, is that if I want to create a new build all I do is:

  • Create a new build batch file - eg home.wxph.sp2.retail.b1.cmd
  • Edit this file to point to the correct source version (ie wxph.sp2.retail) and include any $OEM$ files I want
  • Run the new batch file - it creates all the necessary folders and runs nLite
  • Skip through the nLite options making any necessary changes
  • Click on the nLite Build button
  • Burn the resultant ISO to CD (after testing in VMWare Workstation!!)

If I want to speed up the nLite configuration process, I can copy some existing settings files in to the Presets folder, or create a separately named copy in my master 'Settings' folder

Things I still have to do:

  • Update the nLite.cmd so that it can extract the Windows version from the batch file name passed as parameter 1
  • Update the nLite.cmd so that I can include the $OEM$ folder name in the batch file name passed as parameter 1
  • Update the nLite.cmd so that it builds point versions of the resultant ISO - eg work.wxpp.sp2.vlk.b1.v1.iso, work.wxpp.sp2.vlk.b1.v2.iso - that way I can keep all the build versions until I know I can get rid of them
  • Buy a bigger hard disk

I hope this is helpful - it certainly works for me.

Also, I'm not a developer, so it may be there are much better ways to do some of this - please let me down nicely if I'm being a plank :)

Thanks, Nick

Edited by nwarren
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...