Windows – Creating a pre-install environment with WAIK – Windows

You must download and install the correct version of the Windows 10 WAIK to create a WinPE installation environment.  You should use the version of the WAIK that matches the version of windows you intend to install. This will install as a “Windows Kit” and includes a command-line interface called “Deploying and Imaging Tools” to run the commandd below.  Be sure to open that command line with “run as admin” or the commands below will not work.

Also note that as part of the WAIK kit you get the “Windows System Image Manager” application which is used to create/update sysprep answer files used in the image preparation process.

Also, before getting started, however, you need to collect the drivers you will need in your boot environment into a single directory (my example below uses C:\Lab_x86_Drivers\ — the “x86” gives away the fact these are 32-bit drivers). Download the drivers you need to a temp directory one at a time. Then in that temp directory, expand the drivers. Since these are not drivers for the system you are building this on you should not expand these in the dell/drivers folder for example. Also, when the installation process starts – cancel it immediately. You’ll be left in that temp directory with the expanded, unzipped drivers which you should then move to your drivers directory of something like C:\Lab_x86_Drivers\. I keep individual drivers separated in different folders within this one root fold. The command below to incorporate the drivers into you boot environment will recurse the entire driver folder structure to find all the drivers you have stored there.

NOTE: Lines that begin with # are comments, all other lines are commands that you give in the command window opened as described above …

# Lynna Jackson’s – WinPE – Pre-Install Boot Environment build steps – 2017
# Creates USB and or CD bootable devices with custom menu
# Download and install windows 10 WAIK from microsoft
# Open Deployment Tools command prompt with admin privs

# This creates a 32-bit boot environment which is needed for Ghost

# this is not an executable batch file ….
# execute commands below in order by manually copy/paste to the deployment tools cmd windows

# Clean-up any left over crap
DISM /Cleanup-Wim

# remove c:\winpe_x86 directory
rmdir /S c:\winpe_x86

# creates/recreates a clean winpe_x86 directory at c:\ and copies winpe files into place
copype.cmd x86 c:\winpe_x86

# mount the winpe wim file
Dism /Mount-Wim /WimFile:C:\winpe_x86\media\sources\boot.wim /index:1 /MountDir:C:\winpe_x86\mount

# check on the packages loaded
Dism /image:c:\winpe_x86\mount /Get-Packages

# Find and copy cab files – inthe windos 10 aik these were in:
# C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs”
# copy the specifc cabs you need to the c:\lj1_winpe\windows10cabs\ folder

# then add packages to the mounted image
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:C:\LJ1_WinPe\windows10cabs\WinPE-HTA.cab
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\LJ1_WinPe\windows10cabs\WinPE-HTA_en-us.cab”
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\LJ1_WinPe\windows10cabs\WinPE-WMI.cab”
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\LJ1_WinPe\windows10cabs\WinPE-WMI_en-us.cab”
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\LJ1_WinPe\windows10cabs\WinPE-WDS-Tools.cab”
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\LJ1_WinPe\windows10cabs\WinPE-WDS-Tools_en-us.cab”
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\LJ1_WinPe\windows10cabs\WinPE-Scripting.cab”
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\LJ1_WinPe\windows10cabs\WinPE-Scripting_en-us.cab”

# check on the drivers loaded
Dism /image:c:\winpe_x86\mount /Get-Drivers

# add drivers – (This is a 32-bit boot environment so you need 32-bit drivers … )
Dism /image:C:\winpe_x86\mount /Add-Driver /Recurse /driver:C:\lj1_winPe\x86_Drivers\

# add custom scripts
xcopy /e /y “C:\lj1_winPe\Lab_winpe_scripts” C:\winpe_x86\mount\Windows\System32\

# increase ram disk scratch space for application
dism /image:c:\winpe_x86\mount /Set-ScratchSpace:512

# set the time zone
dism /image:c:\winpe_x86\mount /set-timezone:”Eastern Standard Time”

# unmount win_pe image and commit changes
Dism /Unmount-Wim /MountDir:C:\winpe_x86\mount\ /Commit

# copy customized winpe boot environment
copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim /Y

# create the ISO for the boot disk
oscdimg -n -bc:\winpe_x86\fwfiles\etfsboot.com c:\winpe_x86\media c:\winpe_x86\winpe_x86.iso

# burn iso to cd

# and/or mount iso to copy contents to bootable USb devices (see notes below to format correctly)

# copy the ISO contents to formated USB stick (see notes about diskpart format below)
xcopy [mounted iso directory]*.* /e f:\

# copy the ISO contents to the saved location on your hard drive to keep it safe
# the winpe_x86 directory is erased and recreated each time you run this process
copy c:\winpe_x86\winpe_x86.iso c:\lj1_WinPE\

=======================================

Formatting a USB stick to make it bootable …

C:\diskpart

Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: LAB-WIN7-DEV

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 149 GB 0 B
Disk 1 Online 1928 MB 0 B

DISKPART> sel disk 1

Disk 1 is now the selected disk.

DISKPART> clean

DiskPart succeeded in cleaning the disk.

DISKPART> create parti prim

DiskPart succeeded in creating the specified partition.

DISKPART> active

DiskPart marked the current partition as active.

DISKPART> format fs=NTFS quick

100 percent completed

DiskPart successfully formatted the volume.

DISKPART> assign

DiskPart successfully assigned the drive letter or mount point.

DISKPART> exit

Leaving DiskPart…

This entry was posted in Labs and tagged , , . Bookmark the permalink.

Comments are closed.