Automate Imaging via USB Drive

I created a bootable USB drive that can be used by anyone to setup a machine. Once completed, the process requires no real technical ability.

What does this allow me to do?

1- Boot from USB Drive
2- One prompt alerting user that all contents will be erased
3- Setup 4 partitions: system, data, recovery, and reserved for windows
4- Restores the Recovery partition
5- Restores the System partition
6- Setup Windows 7 0 touch
7- Installs drivers, apps, scripts 0 touch
8- 100% complete: no errors and everything works

Created a bootable USB
———————————————————————
– used diskpart to format a USB drive
create primary partition, format, set active
– copied over winpe bootable files
———————————————————————

Created a diskpart.txt setup file
(to be stored on the root of USB drive)
———————————————————————
Select disk 0
Clean
Create partition primary size=100
Select partition 1
Format fs=ntfs label=”System Reserved” quick
assign letter=s

Create partition primary size=100000
select partition 2
Format fs=ntfs quick
assign letter=m

Create partition primary size=49000
select partition 3
Format fs=ntfs label=”Recovery” quick
assign letter=n

Create partition extended
select partition 0
Create partition logical size=100000
select partition 4
Format fs=ntfs label=”Data” quick

Select partition 1
active
exit
———————————————————————

Modified the startnet.cmd in the boot.wim
(you have to mount the wim and go to the system32 folder)

Startnet.cmd
———————————————————————
if exist c:\recovery.wim set MyDrv=c
if exist d:\recovery.wim set MyDrv=d
if exist e:\recovery.wim set MyDrv=e
if exist f:\recovery.wim set MyDrv=f
if exist g:\recovery.wim set MyDrv=g
if exist h:\recovery.wim set MyDrv=h
if exist i:\recovery.wim set MyDrv=i
if exist j:\recovery.wim set MyDrv=j
if exist k:\recovery.wim set MyDrv=k
if exist l:\recovery.wim set MyDrv=l

rem performs partitioning
diskpart /s %MyDrv%:\diskpart.txt

rem restores the recovery partition
%MyDrv%:\imagex /apply %MyDrv%:\recovery.wim 1 n:\

rem restores the system partition
%MyDrv%:\imagex /apply n:\boot\wim\image.wim 1 m:\

rem makes the reserved partition bootable
bcdboot m:\windows /s s:
bootsect /nt60 s:
———————————————————————

Complete USB Drive Setup
———————————————————————
– Copy Recovery.WIM to USB drive (contains the recovery partition)
– copy imagex.exe to USB drive
– copy diskpart.txt to USB drive
———————————————————————

Test USB drive
———————————————————————
– Boot to USB drive
– tested successfully – fully partitioned drives,
restored Recovery partition, restored System partition,
setup Windows 7, installed apps, drivers, scripts
– 100% success
———————————————————————

email me