Video Screencast Help
Protect Your POS Environment Against Retail Data Breaches. Learn More.

Quicker Scripted OS Install

Created: 13 Feb 2009 • Updated: 13 Feb 2009 | 8 comments
Language Translations
Pikoshi's picture
+4 4 Votes
Login to vote

Everyone knows that the Deployment Server can automatically install Windows on a machine
via a job deployment, but that job usually takes quite a bit of time and a few reboots
to complete.

There is a faster way. With the Scripted OS install that is built into the Deployment
Server, it first deploys a Fat32 DOS image, followed by running a script to copy over
files from the DS for configuration, and then runs the install by calling the WINNT.EXE
from the deployment server. This is fine if you have the time to sit and wait for the
install to copy over the needed install files, and then start the setup. In-between the
copying of files (which takes a long time), the drive is converted from Fat32 to NTFS, again
taking more time. In our environment, we do not always have the luxury of time. In this
article, I will show you how to streamline the install process.

Okay, let us look at some of the things we will need before we begin:

  1. A blank hard drive
  2. A Windows XP CD(preferably not an OEM disk as these may or may not come with files for a specific computer manufacturer)
  3. Unattend.txt and aclient.inp files. You can obtain the unattend.txt file by creating a standard Scripted OS Install job, or you can choose to make this yourself with Microsoft's Setup Manager found within the Support Tools on a Windows XP CD. For more info on this, visit http://unattended.msfn.org/unattended.xp. The Aclient.inp can be created with the Deployment Server Console.

Pre-Work

Step 1: Create your unattend.txt and aclient.inp

Step 2: Copy these files to a location on your DS, making sure to note the location as it will be used later.

Step 3: Format your blank hard drive to NTFS.

Step 4: Copy the i386 folder from your Windows XP disk to your freshly formatted hard drive.

Step 5: Upload an image of your drive with the i386 folder to your deployment server (you may want to name this something easy to remember, like i386NTFS.img)

Now that we have an image, we can start building the actual job for scripting the OS install. Create a new job and add in an image deployment task. You will want to use Rdeployt for the imaging software and WinPE 32bit for the Preboot environment so there are fewer reboots. The image to be deployed is the one you captured earlier. For the advanced options, we have ours set to Leave the Automation Partition, but delete the OEM Partition. This really depends on your particular environment and what you want to set it to.

Optional Step 1: If you want to create this as a hardware independent install, there are many ways to complete this. In our environment, we use a hand created script to copy down the drivers based on the product name. I have attached a copy of this script below, but I am not going to go into detail as to how it was created or what properties need to be changed for your environment. You may PM me if you would like to know the mechanics behind creating something like this. It takes a little trial and error to tailor this to different environments. You will also need to make sure your unattend.txt file has a line called OemPnPDriversPath that outlines the locations on your hard drive that you copy the drivers to so that the install knows where to grab them from.

REM Copy Driver files to the production partition before the
REM operating system starts.

REM This section is used to locate and use specific drivers based on the model of
REM computer running the job.

C:
md Drivers
F:

if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="Latitude_D600" goto D600
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="latitude_d600" goto D600
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="Latitude_D610" goto D610
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="latitude_d610" goto D610
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="Latitude_D620" goto D620
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="latitude_d620" goto D620
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="Latitude_D630" goto D630
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="latitude_d630" goto D630
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="Latitude_X300" goto X300
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="latitude_x300" goto X300
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="latitude_d410" goto D410
if "%#*"SELECT REPLACE(prod_name, ' ' , '_') FROM computer WHERE computer_id=%ID%"%"=="Latitude_D410" goto D410

REM If no match is found, exit the script.
goto Exit

:X300
xcopy .\sysprep\models\x300\Drivers C:\Drivers /E /Y
goto Exit

:D410
xcopy .\sysprep\models\D410\Drivers C:\Drivers /E /Y
goto Exit

:D600
xcopy .\sysprep\models\D600\Drivers C:\Drivers /E /Y
goto Exit

:D610
xcopy .\sysprep\models\D610\Drivers C:\Drivers /E /Y
goto Exit

:D620
xcopy .\sysprep\models\D620\Drivers C:\Drivers /E /Y
goto Exit

:D630
xcopy .\sysprep\models\D630\Drivers C:\Drivers /E /Y
goto Exit

:Exit
exit

Optional Step 2: In our environment we use token replacement in our unattended.txt file for the naming of the computer. You can choose to do this or not. I have attached a sample copy of one of our unattended.txt files at the end of this article that shows how to put the token into the txt file. Most of you know how to do token replacement, but for those that do not, create a run script task and put the following in the window:

REM Token Replacement Task for UNATTEND:TXT
REM Replacetokens .\Location of unattend.txt file\unattend.txt .\temp\%ID%.inf

Now we need to copy over our unattend.txt, aclient.inp, and our DS client for production, plus actually start the installation. We use the Aclient in our environment, so this will assume the same. In order to accomplish all this, we turn to another script. Now all of these scripts could be included into one long script if you choose to. We prefer to keep them separate for diagnostic purposes. Again, this script is run as a Windows script using the WinPE 32bit Automation environment. With this script, I am not sure you could run it in DOS, due to it calling the WinNT32.exe.

The script is as follows:

REM Script to copy needed files
c:
cd \
md altiris
cd altiris
md aclient
md files
cd files
cd \
copy F:\temp\%ID%.inf c:\altiris\files\unattend.txt
copy F:\agents\aclient\altiris-aclient-6.9.164.X86.exe C:\altiris\aclient\aclient.exe
copy F:\Deploy\unattend\aclient.inp c:\altiris\aclient\aclient.inp

c:\i386\winnt32.exe /unattend:c:\altiris\files\unattend.txt /s:c:\i386 /syspart:C: /tempdrive:C: /noreboot

Note: If you do not use token replacement for computer naming, you will need to change the first Copy From location to where you have your unattend.txt file stored on the server. Also, on the second copy you will need to modify which agent you copy over based on your environment. We use an older agent for ours due to our upgrade process being convoluted and taking forever to get approved.

Now since we deployed an image to the computer of the i386 folder on an NTFS drive, it calls all the install files and commands from the local hard drive which is much quicker. Also, the Scripted OS Install included with Altiris calls the winnt.exe file which is considerably slower than the winnt32.exe file. Now depending on how you made your unattend.txt file, the whole install may be automated or you may need to enter a few pieces of information.

This install process only takes about 25 minutes to complete on a Dell D620 laptop with a 2.0Ghz processor and 2gigs of ram. Now if you compress the WinPE Automation environment like in Altiris KB article 22971, you can reduce that time down even further. I've seen reports of reducing the install time down to 15 minutes from start to finish. We have yet to see these speeds in our environment, but then that could be due to our network.

Unattend.txt

;SetupMgrTag
[Data]
  AutoPartition=1
  MsDosInitiated="0"
  UnattendedInstall="Yes"

[Unattended]
  UnattendMode=FullUnattended
  OemSkipEula=Yes
  OemPreinstall=Yes
  TargetPath=\WINDOWS
  OemPnPDriversPath="Drivers\NIC;Drivers\Video;Drivers\Audio;Drivers\Cardbus;Drivers\Chipset;Drivers\Modem;Drivers\Blue;Drivers\Wireless;Drivers\TPM;Drivers\Thumb;Drivers\SmartCard"

[GuiUnattended]
  AdminPassword="YOUR LOCAL ADMIN PASSWORD"
  EncryptedAdminPassword=NO
  OEMSkipRegional=1
  TimeZone=4
  OemSkipWelcome=1

[UserData]
  ProductKey=YOUR PRODUCT KEY
  FullName="YOUR NAME"
  OrgName="YOUR COMPANY NAME"
  ComputerName=%NAME%

[Display]
  Xresolution=1024
  YResolution=768

[TapiLocation]
  CountryCode=1

[RegionalSettings]
  LanguageGroup=1
  SystemLocale=00000409
  UserLocale=00000409
  InputLocale=0409:00000409

[GuiRunOnce]
  Command0="c:\altiris\aclient\aclient.exe c:\altiris\aclient\aclient.inp -silent -install -scriptedinstall"

[Identification]
  JoinDomain=YOUR DOMAIN
  DomainAdmin=YOUR DOMAIN ADMIN ACCOUNT
  DomainAdminPassword=YOUR DOMAIN ADMIN PASSWORD

[Networking]
  InstallDefaultComponents=Yes

The last thing I would recommend doing is adding a script at the end that runs in production to delete the unattend.txt file that we copied to the hard drive. If you choose not to do this step, be warned that anyone can access this file and see both the local admin password or your domain admin account and password if you choose to have the install add the computer to your domain.

This is kind of a high level overview of what we have done in our enviroment. My next article will dive indepth into what exactly is going on at each step and I will go more into depth regarding the hardware indepenent portion.

Below shows what our console looks like after adding in all the tasks to the job:

Comments 8 CommentsJump to latest comment

spazzzen's picture

Great article. I have been trying to get it to work as I want to try to modify this to work for an x64 installation as I have not found a way to get the DS Scripted OS install to work for XP 64.

Anyways, 2 questoins.
1. Does this only work for WinPE or can I use DOS instead? The reason I ask is I have 6.9 sp1 mp1 and I am still experiencing the issue described in KB 44281. Which is why I have come accustome to using Dos over WinPE.
2. What is your script to delete the unattened files?

Thanks and keep it up.

+2
Login to vote
Pikoshi's picture

Spazzen,

Yes everything in this process will work for DOS, though things will be a little slower as you will have to call WinNT.exe instead of Winnt32.exe. Form my expirence, the Winnt32.exe will error out in DOS.

The script I use to delete the unattened file(I only delete this one file as we have various uses for the other files) is a simple run script command of "del c:\Altiris\Files\unattend.txt"

Also, this should work for 64bit installs with a little modification. Your preboot would have to be a 64bit preboot enviroment and the image you intially push down would have to include the 64bit version of the i386 files, but those are both pretty easy to pull off.

If your question was answered, mark the anwser as the solution
Give thumbs up if you found a post helpful

+2
Login to vote
spazzzen's picture

You sure Dos will recognize ntfs? I can't get it to recognize the C: drive. It basicalyl doesn't see that there is a partition on the hard drive.

+1
Login to vote
Pikoshi's picture

Ahh yes I forgot about that. You would need to format the drive as FAT32 then have the Windows installer in conjunction with your unattend file convert the drive to NTFS later in the procedure. I believe the call would look something like

WINNT.EXE /u:c:\altiris\files\unattend.txt /s:C:\i386 /noreboot

and the line in the unattend file would look like

FileSystem = ConvertNTFS

There is some talk about there being a way to load a version of DOS that can read NTFS into the DS as a preboot environment, but I do not believe anyone has gotten it to work as of yet.

If your question was answered, mark the anwser as the solution
Give thumbs up if you found a post helpful

+3
Login to vote
Nelo's picture

I think you need a x64 preboot environment to accomplish this right?

That is true for Windows 2003 x64, and DOS will fail.

Nelson

+1
Login to vote
Pikoshi's picture

Yes, for a 64bit install you will need WinPE 64bit preboot environment because DOS cannot tun 64bit programs.

If your question was answered, mark the anwser as the solution
Give thumbs up if you found a post helpful

+1
Login to vote
spazzzen's picture

I tried using a modified version of this for a xp64, but when I tell WinPE (either x86 or 64 bit) i get the error "This version of c:\i386\winnt32.exe is n ot compatible with the version of Windows you're running.  Check your computer's system information to see wheter you need a X86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher."

I am basically using the exact same script you have above for xp 64 bit.  I get the error from this command: c:\i386\winnt32.exe /unattend:c:\altiris\files\unattend.txt /s:c:\i386 /syspart:C: /tempdrive:C: /noreboot

0
Login to vote
Pikoshi's picture

Spazzzen,

The only thing I can think of as far as why this would not work is that the winnt32.exe is a 32bit program but the preboot environment is a 64 bit environment and can therefore not properly run the 32 bit version.  Let me check the i386 folder on a Windows XP 64bit disk and let you know what I find.

If your question was answered, mark the anwser as the solution
Give thumbs up if you found a post helpful

0
Login to vote