Creating an 'Auto' Unnattended Image Installer
If you need to quickly reinstall/image a PC and you don't want to hang around or setup PXE boot - just put the USB/DVD in and boot, walk away come back and find it imaged and "drivered", leaving you to just rename/register the machine.
There are a few ways of doing this. This way keeps the image and the deployment part, what writes the image, separate. So if you are using a USB media you can just drag and drop the new image file. Also as USB media you can edit the startup routine without redoing the bootable media build. DVD media is best for new installs and I use the USB one for repairs/reinstalls. You might find it useful for other ideas you have!
Creating the Win PE Boot Media
1. Techinician PC/VM with Windows AIK and Win 7 Pro (latest Win PE boots faster than Vista PE)
2. Walkthrough: Create a Bootable Windows PE RAM Disk on CD-ROM
3. Walkthrough: Create a Custom Windows PE Image
We need to modify Win PE so it runs our program/bat file on startup. This means we edit startnet.cmd ie Customising the Win PE image. As mentioned in the link you would need to mount the boot.wim image and then find startnet.cmd in e.g.:
In this system32 directory we need to add imagex.exe and CHOICE.exe. for applying images and for an abort procedure in our bat file (shown further down the document). Copy the two exe files (find the correct architecture - in this case x86) e.g:
copy "C:\program files\<version>\Tools\<architecture>\imagex.exe" c:\winpe_x86\mount\windows\system32
(Search your Windows <x86> PC for CHOICE.exe)
To avoid remounting boot.wim and dismounting, everytime we want to edit the startup script, we edit the startnet.cmd to load a "main" script in the DVD/USB drive root (Win PE RAM disk defaults to a spearate X drive). We don't know what drive letter the CD may have when Win PE loads so we try most possibilities, in ...\mount\Windows\system32\startnet.cmd add the following after the wpeinit line:
... and so on.Code:wpeinit call c:\main.bat c 2>nul command call d:\main.bat d 2>nul command call e:\main.bat e 2>nul command
2>nul command hides error msgs and we are also passing the drive letter as an argument.
There may be a better way to get the drive letter of the DVD/USB!
In summary, to add/edit the X: drive, the Win PE system drive, you need to mount boot.wim on your technician PC and edit files in /mount and then unmount and "commit". Don't add images to the X drive as it is a RAM drive and will crash Win PE because not enough RAM is available (x86 limit or PC has just doesn't have enough physical RAM).
We now add a main.bat script to the root of our DVD/USB, which is 'in' e.g. -
c:\winpe_x86\ISO\ (will appear as d: or e: drive etc. when Win PE is loaded as X.
In main.bat you would again pass the drive letter variable to another script e.g.:
(There's probably a one line way to update the env path or something to change current working directory)Code:%1:\imagingscript.cmd %1
To make files available under the DVD/USB drive, add files to the \iso directory. To add an image to the DVD/USB you would just copy to the ISO folder:
Create a Bootable DVD
Create an .iso file by using the Oscdimg tool. On your technician PC, create an .iso file with Oscdimg. At the prompt, type (you may need to use the -m command because the iso will be large):
To remove the "Press any key to boot from CD" prompt during boot, remove the bootfix.bin file from the \boot folder within your mounted image. I prefer to keep the press any key, in case you forget to take the DVD out! Burn the image (.iso) onto a DVD. (no boot options required on Nero or other burning software!)Code:oscdimg -n -m -bC:\winpe_x86\etfsboot.com C:\winpe_x86\ISO F:dvdboot.iso
Creating a Bootable USB
Copy the contents of the ISO folder, e.g. C:\winpe_x86\ISO to a bootable USB. You can make it via Diskpart on Vista/Win 7.
Countdown and Abort Script
To reboot the machine use (especially if booting from DVD) this line:Code:@ECHO OFF setLocal EnableDelayedExpansion REM sets the variable for seconds to wait set /a counter= 10 set checktime= %time:~7,1% :timecheck if /i %checktime% equ %time:~7,1% (goto timecheck) set /a checktime= %time:~7,1% set /a counter = %counter% - 1 goto display :display CLS Echo Seconds Remaining: !counter! REM check counter if /i %counter% equ 0 goto finish Echo Press A to abort imaging: CHOICE /T 1 /C al /D l /N if %errorlevel% equ 2 (goto timecheck) if %errorlevel% equ 1 (goto abort) REM else return back and check the time goto timecheck :abort: echo Aborted! exit /b :finish echo IMAGING diskpart /s %1:\dp.txt imagex /apply %1:\image\c_drive.wim 1 c: end /b
Example diskpart script to prepare the C drive:Code:wpeutil reboot
Creating the Sysprep ImageCode:select disk 0 clean create partition primary active assign letter=c format fs=ntfs quick
How to use the Sysprep tool to automate successful deployment of Windows XP
How to use Sysprep with Windows Product Activation or Volume License Media to deploy Windows XP
How to Add OEM Plug and Play Drivers to Windows XP
If you have Volume Licence media and a VL key you can sysprep unlimited times - sysprep machine A, then use it to image machine B, update missing drivers and then sysprep, then apply that image on machine C, update drivers and so on. Final image has all drivers for 3 systems!
Use sysprep.inf to automate mini-setup and have it autologin as Administrator. You can place on the Desktop e.g. Aida32 and CPUID to ID motherboards, shortcuts link to PC supplier driver webpages, in case any drivers are missed or you're imaging on an 'unknown' PC.
It's important to have network access straightaway, so I've added all the intel, broadcom, Marvell, 3com ethernet drivers into the sysprep setup. If drivers come as exe files you may have to run it and then check your temp directory for the folder with the actual driver inf files.
I've used this on new PCs and have it ready in 10 minutes (open box, assemble PC on desk 5 mins, imaging 5 mins). Can be longer if it's an 'unknown' machine and I have to download drivers ~ 20 mins.
Big thanks to Google. Bing and MS' own internal search is s**t.
There are currently 1 users browsing this thread. (0 members and 1 guests)