Customized Windows PE 5.0

A quick run-through covering creating a customized Windows PE bootable drive, mainly so I don't space out and forget any of the steps (*ahem* again).

The below is based on the Deployment and Imaging tools available by installing Windows ADK 8.1


Create Windows PE files

Run Deployment and Imaging Tools Environment as Administrator

Create the base structure with copype command:

copype <architecture> <directory>

Example for 64 bit:
copype amd64 c:\winpe64

Example for 32 bit:
copype x86 c:\winpe32


Paths to packages

amd64:
\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs


x86:
\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs



Mount boot.wim

(assuming current path is the root of WinPE, e.g., c:\winpe)

dism /mount-wim /wimfile:media\sources\boot.wim /index:1 /mountdir:mount




Adding Key Packages

(assuming current path is \Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs)


1:  dism /image:c:\winpe\mount /add-package /packagepath:WinPE-Scripting.cab  
2:  dism /image:c:\winpe\mount /add-package /packagepath:en-us\WinPE-Scripting_en-us.cab  
3:    
4:  dism /image:c:\winpe\mount /add-package /packagepath:WinPE-WMI.cab  
5:  dism /image:c:\winpe\mount /add-package /packagepath:en-us\WinPE-WMI_en-us.cab  
6:    
7:  dism /image:c:\winpe\mount /add-package /packagepath:WinPE-MDAC.cab  
8:  dism /image:c:\winpe\mount /add-package /packagepath:en-us\WinPE-MDAC_en-us.cab  
9:    
10:  dism /image:c:\winpe\mount /add-package /packagepath:WinPE-HTA.cab  
11:  dism /image:c:\winpe\mount /add-package /packagepath:en-us\WinPE-HTA_en-us.cab  
12:    
13:  dism /image:c:\winpe\mount /add-package /packagepath:WinPE-NetFx.cab  
14:  dism /image:c:\winpe\mount /add-package /packagepath:en-us\WinPE-NetFx_en-us.cab  
15:    
16:  dism /image:c:\winpe\mount /add-package /packagepath:WinPE-PowerShell.cab  
17:  dism /image:c:\winpe\mount /add-package /packagepath:en-us\WinPE-PowerShell_en-us.cab  
18:    
19:  dism /image:c:\winpe\mount /add-package /packagepath:WinPE-DismCmdlets.cab  
20:  dism /image:c:\winpe\mount /add-package /packagepath:en-us\WinPE-DismCmdlets_en-us.cab  


Add customizations

Add a customized HTA menu (e.g., menu.hta in \windows\hta\) then add the below line to startnet.cmd in \windows\system32 to open it on startup:

%windir%\system32\mshta.exe %windir%\hta\menu.hta




Unmount boot.wim after committing changes

dism /unmount-wim /mountdir:c:\winpe\mount /commit


Prepare USB stick

(via either diskpart or Disk Management. The partition must be marked as Active.)

diskpart
list disk
select <disk number>
clean
create partition primary
format quick fs=ntfs label="WinPE"
assign letter=W
active


Example for finding the correct Disk number:

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB      0 B
  Disk 1    Online         7634 MB      0 B

DISKPART> sel disk 1

Disk 1 is now the selected disk.


Alternatively, prepare a USB HDD with multiple partitions:


diskpart
list disk
select <disk number>
clean
create partition primary
format quick fs=ntfs label="WinPE"
assign letter=W
active
select <disk number>
clean
create partition primary
format quick fs=ntfs label="Data"
assign letter=X


It's worth noting that UEFI only supports booting from FAT32 partitions.


Copy \media\ and its sub-directories to the root of the USB stick/drive:

robocopy /mir c:\winpe\media w:


Comments

Popular posts from this blog

Change the ComputerName value in Unattend.xml using PowerShell

Testing out Link Aggregation

Adding 802.1Q Trunking to Debian GNU/Linux