This script is based of Michael Khanins WinPE 3.0 Script and extended with automatic driver integration, an explorer like shell, autostart entries, modified languages for the PE environment and useful programs.
Pre-Requirements
Microsoft Windows AIK for Windows 7
This script needs to be run from an administrative Deployment Tools Command Prompt.
You should have the following folder structure:
All Programs in the Programs Folder will be included in the WinPE under Program Files.
Script
@echo off %SYSTEMDRIVE% CD "C:Program FilesWindows AIKToolsPETools" Set Architecture=x86 Set PEDest=d:WinPE30Image Set ISOName=winpe_x86.iso Set removeboot=true Set SourceDir=d:WinPE30 pushd %cd% call copype.cmd %Architecture% %PEDest% Dism /Mount-Wim /WimFile:%PEDest%winpe.wim /index:1 /MountDir:%PEDest%mount Dism /image:%PEDest%mount /Set-InputLocale:0407:00000407 Dism /image:%PEDest%mount /Get-Packages Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPswinpe-hta.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPsen-uswinpe-hta_en-us.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPswinpe-legacysetup.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPsen-uswinpe-legacysetup_en-us.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPswinpe-mdac.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPsen-uswinpe-mdac_en-us.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPswinpe-pppoe.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPsen-uswinpe-PPPOE_en-us.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPswinpe-scripting.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPsen-uswinpe-scripting_en-us.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPswinpe-wmi.cab" Dism /image:%PEDest%mount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPETools%Architecture%WinPE_FPsen-uswinpe-wmi_en-us.cab" copy "C:Program FilesWindows AIKTools%Architecture%imagex.exe" %PEDest%mountWindowsSystem32 REM Copy NIC and Mass Storage Drivers into PE-Image echo. echo Including Network Interface Card drivers... REM Dism /image:%PEDest%mount /Add-Driver /driver:%SourceDir%NICSubfoldermydriver.inf echo. echo Including Mass Storage drivers... REM Dism /image:%PEDest%mount /Add-Driver /driver:%SourceDir%MassStorageSubfoldermydriver.inf echo. REM Copy Programfiles into PE-Image echo Including Programs... xcopy %SourceDir%Programs* "%PEDest%mountProgram Files" /e /i /h echo. echo Configuring Autostart entrys... copy %SourceDir%winpeshl.ini %PEDest%mountWindowsSystem32 echo. Dism /Unmount-Wim /MountDir:%PEDest%mount /Commit Copy %PEDest%winpe.wim %PEDest%ISOsourcesboot.wim IF "%removeboot%"=="true" del /q %pedest%isobootbootfix.bin oscdimg -n -b%PEDest%etfsboot.com -lWinPE_30 %PEDest%ISO %PEDest%%ISOName% Dism /cleanup-wim popd pause
Explanations
/Set-InputLocale
sets the input locales and keyboard layouts to use in the offline Windows image.
For a list of the default input locale values, see here and here.
You need the hex values to define your locales. If you want to include drivers uncomment the following lines (remove REM to uncomment):
REM Dism /image:%PEDest%mount /Add-Driver /driver:%SourceDir%NICSubfoldermydriver.inf
REM Dism /image:%PEDest%mount /Add-Driver /driver:%SourceDir%MassStorageSubfoldermydriver.inf
You need one line per inf file. You can also change the folder structure. The folders were just added to differ between the drivers.
With winpeshl.ini you configure your autostart entries.
winpeshl.ini has the following content:
[LaunchApps]
%SYSTEMDRIVE%Windowssystem32startnet.cmd
%ProgramFiles%bginfobginfo.cmd
%ProgramFiles%bsexplorerBsLogon.exe
startnet.cmd does general initialization for the PE environment.
bginfo.cmd runs a pre configured Background Information script.
BsLogon is the first exe to get BsExplorer working.
BsExplorer is an Explorer like environment.
You can get it from here: http://www.kursknet.ru/~boa/en/index.html –> windows pe –> My programs for Win PE.
My BsExplorer config and a modified CommonEng.dll, with Ressource Hacker to correct some language mistakes, is uploaded as a zip-Archive here.