Roger Lund ' s IT and VMware / Virtualization Forum & Resources




Roger Lund ' s IT and VMware / Virtualization Forum


IT And Virtualization Wiki

Educait.net - Collaboration and Education in the Central Minnesota IT Community
CentralMnIT.com - Central Minnesota IT & Virtualization User Group

Monday, January 5, 2009

How to Setup a Windows XP Unattended Installation.

I use a Windows XP Unattended Installation instead of a Desktop imaging application, and I wanted to share my setup. ( all software licensing is your responsibility )

I will go over the basics, and expect that I will get a few questions, which is fine. What I wont do is explain what setting does what, as this is a how to, I can expand on things, just ask, and I am sure people will find typo’s.

First we have some work to do to get things in order, this setup requires that you know what model of computer’s your using, and that you have domain access to add devices to Network. You will also need full access to a network share, and a Windows XP disk of your choice.

Additionally, you will need a Windows 98 boot disk, and network boot disk. Plus, you will need to download the chipset, audio, video, and Lan drivers for the computer your building, and you’ll need 7zip to extract the drivers from each installer.

Once you have downloaded each driver put them each in a separate folder, under the computer model, and right click each and use 7zip to extract them.

Make sure you download wireless and or TMP drivers as well. Once you have the drivers in something like 755, and under that a folder for chipset, audio, video, lan, and have extracted each, C:\driver\755\audio , C:\driver\755\video ( tested with HP/ Dell / IBM / computers, this should give you lots of files and a few folders in each sub folder, and not just one installer, ) we can come back to the files later.

In my Example, I am going to use Windows XP Pro OEM, and a Dell Optiplex 755 USFF that has a XP Pro OEM Key.

1. On your network share, create a unattended folder, and share it as unatt$

2. Inside of the unattended folder, crease a folder for each version of Windows XP you want to create, in my case, I am only using one ( for this example ) so I will call it OEM.

3 .Insert your Windows XP CD, and copy the I386 directory, ( make sure you have the folder options setup to see hidden files ) , paste the directory into your folder in unattended. My case I am using drive X:\unattended\oem\I386 , so now you should have a copy of your windows CD’s I386 directory for your unattended.

4. Browse back to X:\unattended\oem and make a $OEM$ folder, this will hold your files for the unattended install ( drivers and such )

5. google SMARTDRV.EXE, and download it to X:\unattended, and copy it X:\unattended\oem also.

6. Browse to X:\unattended , and make a file called oem.bat, and put in the following. ( this will be ran from dos )

SMARTDRV.EXE

net use /Y X: /delete
net use X: \\servershare\unatt$
cd unatten~1
cd oem

Call X:\oem\XPDRIVER.BAT

7. Browse back to X:\unattended\oem and make a file called XPDRIVER.BAT and put in the following

"SMARTDRV.EXE"

:: Set environmental variables
set AnswerFile=XPDRIVER.sif
set SetupFiles=i386

i386\winnt.exe /u:%AnswerFile% /s:%SetupFiles%

8. make a file called XPDRIVER.SIF, and put in the following, enter in your name and company name as needed. ( FullName="putinnamehere" OrgName="putincompanyhere" ) but leave everything else. ( I am removing games, and components, and turning off windows firewall here, see below. )

;SetupMgrTag
[Data]
AutoPartition=1
MsDosInitiated="1"
UnattendedInstall="Yes"
AutomaticUpdates=no
[Unattended]
UnattendMode=FullUnattended
OemPreinstall=Yes
ConfirmHardware=No
TargetPath=WINDOWS
FileSystem=ConvertNTFS
Repartition=Yes
OemSkipEula=Yes
UnattendSwitch="yes"
WaitForReboot="No"
OemFilesPath="X:\OEM\$OEM$"
OemPnPDriversPath="Drivers\000;Drivers\001;Drivers\002"
DriverSigningPolicy=Ignore
Hibernation=No
KeyboardLayout="US"
[GuiUnattended]
OEMSkipRegional=1
TimeZone=20
OemSkipWelcome=1

[UserData]
ProductID=""
FullName="putinnamehere"
OrgName="putincompanyhere"
ComputerName=""
[Display]
Xresolution=1024
YResolution=768
AutoConfirm=1

[Components]
deskpaper=Off
indexsrv_system=Off
games=Off
msnexplr=Off
OEAccess=Off
zonegames=Off
msmsgs=Off
freecell=Off
hearts=Off
minesweeper=Off
pinball=Off
solitaire=Off
spider=Off

[NetOptionalComponents]
SNMP = 1
WBEMSNMP = 1
[Networking]
InstallDefaultComponents=Yes

[Shell]
DefaultStartPanelOff = Yes
DefaultThemesOff = Yes

[GuiRunOnce]
"%systemdrive%\install\icon.cmd"
"%systemdrive%\install\clean2.cmd"
"%systemdrive%\install\clean.cmd"

[WindowsFirewall]
Profiles = WindowsFirewall.TurnOffFirewall

[WindowsFirewall.TurnOffFirewall]
Mode = 0

9. Browse to X:\unattended\OEM\$OEM$ , and create a file called cmdlines.txt, and put in the following.

[Commands]
"unpack.cmd"
"DRIVERS.cmd"
"IP.cmd"
"Domain.cmd"

10. Create a file called domain.cmd and put in the following, add in the domain , and user, if you wanted you can do * for user, but then you’d have to type it every time, the reason I have type 1 and 2, is in case you mistype.

@ECHO off

:return

echo *********************************************************
echo ** **
echo ** You Must First Add Then Join The Domain **
echo ** ----------------------------------- **
echo *********************************************************
echo ** Make You Selection **
echo *********************************************************
echo ** 2) join domain **
echo ** 3) end **
echo ** **
echo *********************************************************
echo . .
SET /P Choice=Select your choice # and press Enter:

:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%

IF /I '%Choice%'=='2' GOTO join
IF /I '%Choice%'=='3' GOTO end
ECHO "%Choice%" is not valid. Please try again.
ECHO

:: =================================
:join
echo --------------------------------------------
echo Now now joining computer to domain
echo --------------------------------------------
C:

cd \

cd INSTALL

REM Joining computer to Domain

NETDOM /join %COMPUTERNAME% /domain:typedomainhere /UserD:enteruserhere /passwordD:*

GOTO return

:end

11. Create a file called drivers.cmd and put in the following ( here I have a desktop and laptop configuration, but for this example I will only walk us through the desktop setup, you would just copy the desktop configuration and rename it ldrivers.cmd if you needed both)

@ECHO off

:return

echo *********************************************************
echo ** **
echo ** You Must First Select Desktop Or Laptop **
echo ** ----------------------------------- **
echo *********************************************************
echo ** Make You Selection **
echo *********************************************************
echo ** 1) Desktop **
echo ** 2) Laptop/Tablet **
echo ** **
echo *********************************************************
echo . .
SET /P Choice=Select your choice # and press Enter:

:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%

IF /I '%Choice%'=='1' GOTO desktop
IF /I '%Choice%'=='2' GOTO laptop
ECHO "%Choice%" is not valid. Please try again.
ECHO

:: =================================
:desktop
"C:\install\ddrivers.cmd"

GOTO END

:: =================================
:laptop

"C:\install\ldrivers.cmd"

GOTO END

:END

12. Create a file called ip.cmd, and put in the following.

@echo off
:NW_CHOOSE
ECHO.
ECHO 1. STATIC
ECHO 2. DHCP
ECHO 3. Cancel
SET /P NW_CONF=[Do you want to use DHCP or specify a static IP? (Select 1 or 2)]
IF /I "%NW_CONF%" == "1" GOTO NW_INPUT
IF /I "%NW_CONF%" == "2" GOTO NW_SET_DHCP
IF /I "%NW_CONF%" == "3" GOTO END

:NW_INPUT
SET /P STATIC_IP=[IP:]
SET /P SUBNET=[Subnet Mask:]
SET /P GATEWAY=[Default Gateway:]
SET /P DNS=[DNS Server:]
ECHO.
ECHO You specified:
ECHO IP Address: %STATIC_IP%
ECHO Subnet Mask: %SUBNET%
ECHO Default Gateway: %GATEWAY%
ECHO DNS Server: %DNS%
:NW_CONFIRM
ECHO.
SET /P NW_CONF=[Is this correct? Y/N:]
IF /I "%NW_CONF%" == "Y" GOTO NW_SET_STATIC
IF /I "%NW_CONF%" == "N" GOTO NW_INPUT
GOTO NW_CONFIRM

:NW_SET_STATIC
netsh int ip add address "Local Area Connection" %STATIC_IP% %SUBNET%
netsh int ip add address "Local Area Connection" gateway=%GATEWAY% gwmetric=1
netsh int ip add dns "Local Area Connection" %DNS%
GOTO END

:NW_SET_DHCP
netsh int ip set add "Local Area Connection" dhcp
GOTO END

:END

13. Create a file called unpack.cmd and put in the following.

@ECHO ON
REM Starting unpack

C:

cd \

cd install

install.cmd

14. In X:\unattended\OEM\$OEM$ create the following folders.

15. $1 , $$ , and C , go into $1, and create a folder called Drivers, and in Drivers, create a folder 000, 001, and 002.

16. Next browse to where you extracted your chipset drivers to, and copy all of the files ( should be lots of INF and Cat files, from the All Folder) into 000 and 001.

17. Next browse to the folder where you extracted the lan drivers, and find the sub folder where the .ini and .cat files are, and copy everything in that folder to the 002 folder. ( in my case it was something like lan\PRO100\Win32

18. Once you have copied the chipset, and lan drivers to the folders, remove there sub folder’s, so you will only have something like audio, video, tpm, wireless, etc, all under C:\driver\755\audio , C:\driver\755\video. browse to C:\driver\755 ( or the place where you have the video / audio , and etc sub folders, and Highlight the folders, then right click, send to compressed zip folder, name it drivers.zip, we will copy this later.

19. In X:\unattended\OEM\$OEM$\$$ create a INF folder, and copy the contents of X:\unattended\OEM\$OEM$\Drivers\000 to it.

20. In X:\unattended\OEM\$OEM$\c create a folder called INSTALL, then browse to X:\unattended\OEM\$OEM$\c\install

21. Download http://www.info-zip.org/UnZip.html and extract the .exe to the folder.

22. Create a file called Clean.cmd and put in the following contents.

@echo on
REM cleaning install files
cd C:\

cd \

RMDIR /S /Q C:\INSTALL

23. Create a file called clean2.cmd and put in the following contents.

@echo on
REM cleaning driver files
cd C:\

cd \

RMDIR /S /Q C:\DRIVERS

24. Create a file called ddrivers.cmd and put in the following contents( here you can make a new entry for more drivers.)

@echo off

:return

echo ****************************************************
echo ** Custom DESKTOP Video Drivers Insatllation **
echo ** ----------------------------------- **
echo ** Informaton Systems Standard Drivers for **
echo ** Standard Models that are purchased Please **
echo ** Select The Model That You Are Setting Up. **
echo ** **
echo *********************************************************
echo ** Make Your Selection **
echo *************** Based on Motherboard ********************
echo ** **
echo ** 1) Install Dell 755 Drivers **
echo ** 9) end **
echo *********************************************************
echo . .
SET /P Choice=Select your install # and press Enter:

:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
IF /I '%Choice%'=='1' GOTO 755

IF /I '%Choice%'=='9' GOTO end
ECHO "%Choice%" is not valid. Please try again.
ECHO

:: =================================
:755
echo --------------------------------------------
echo Now Install Dell Drivers
echo --------------------------------------------

"C:\install\755\video\setup.exe"
"C:\install\755\audio\setup.exe"
GOTO return

:End

25. Create a file called icon.cmd and put in the following contents, ( this deletes the following shortcuts )

@echo Remove Start menu Sortcuts

del "C:\Documents and Settings\All Users\Start Menu\Set Program Access and Defaults.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Windows Catalog.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Windows Update.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Microsoft Update.lnk"

26. Create a file called logon.reg, and put in the following, put in your domain name where it says putinyourdomainhere.

REGEDIT4

;The purpose of this registry patch is to enable automatic logons to Windows XP

;Microsoft AutoAdminLogon
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\WinLogon]
"DontDisplayLastUserName"="0" ;If enabled Automatic Logon will not function correctly
"IgnoreShiftOverride"="1" ;Disable the Automatic Logon Shift Override Feature
"DefaultDomainName"="putinyourdomainhere" ;Sets default domain
"AltDefaultDomainName"="putinyourdomainhere" ;Sets alt default domain

;The purpose of this registry patch is to disable simple file sharing.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"forceguest"=dword:00000000

27. Create a file called install.cmd and put in the following contents.

@ECHO ON

unzip.exe -so drivers.zip -d "C:\INSTALL"

reg import logon.reg

:end

28. Download netdom.exe , ( get from the admin tool kit ) and copy it to the folder.

29. Copy the .zip file with the rest of the drivers you created into the X:\unattended\OEM\$OEM$\C\INSTALL folder.

Congrats! , you are done with setup.


Now, here we go for install procedure.

  1. boot from the windows 98 boot disk, fdisk , delete the partition, and create a primary dos partition, and reboot back to the boot the same 98 boot disk.
  2. do a format C: /s ( at this point you could make a disk image of a blank drive to save two reboots )
  3. boot from a network boot disk, and map X: to \\servershare\unatt$ being your unattended share.
  4. run “oem.bat” and it should take off ( multiple reboots, and it will prompt for the pc name, password, and windows key. ( use the windows OEM key, or the key needed by the disk you copied your I386 from )
  5. next, it will ask for drivers, and follow the screen directions
  6. next, it asks for static ip or dhcp
  7. next, it asks to join domain.
  8. your done, windows is installed, at first login the clean and clean2 bat files should delete temp files.

What’s left for next time?

Installing applications before windows boots.

Setting up default user




EDIT: made some readability changes, and fixed a typo.

0 comments: