Install this language pack, then that...
Why?
Windows PE is invaluable for system maintenance and recovery. The process of creating bootable media is well documented by Microsoft. During this process, you have to add language packs and optional components if you wish for their functionality to be accessible in the final boot environment. Then you have to add the language packs to the image for the corresponding optional components for all installed language packs. Then you set the image language.
My bolding shows my point of disapproval... This is unacceptably long and complicated with a lot of boiler plate commands. All I wanted was two WinPE ISOs, one for amd64 and one for x86 with most optional components in EN-GB.
The process goes...
1: Copy the required architecture of PE from the ADK install location to a new place.
2: Mount the image into the already created mounted folder
3 (optional): set scratch space
4: Install the language pack you require
5: Install an optional component.
6: Install language pack for that component if they exist.
7: Repeat 6 for all installed languages
8: Repeat 5, 6 and 7 for all required components.
9: Set default language
10: Unmount the image
11: Create ISO from folder structure
Build it quick!
Put this in a text file, save it with a .bat extension and run as administrator to make both amd64 and x86 flavours of Windows PE (tested with WinPE 10) in folders 'WinPE10amd64' and 'WinPE10x86' on the system drive root with most features enabled and default language set to en-gb. It also creates a log file, opens it at the end and runs a PowerShell command to highlight any failed operations.
@echo off
call:IsAdmin
call "%SystemDrive%\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.bat"
call:CreatePE x86
call:CreatePE amd64
pause
goto:eof
:CreatePE
set OUTPE=%SystemDrive%\WinPE10%1
echo Copying Windows 10 PE %1 Files ...
call copype %1 "%OUTPE%" > "%SystemDrive%\PE%1_log.txt"
echo - Mounting image
Dism /Mount-Image /ImageFile:"%OUTPE%\media\sources\boot.wim" /index:1 /MountDir:"%OUTPE%\mount" >> "%SystemDrive%\PE%1_log.txt"
echo - Setting scratch space capacity
Dism /Set-ScratchSpace:512 /Image:"%OUTPE%\mount" >> "%SystemDrive%\PE%1_log.txt"
echo - Adding Language Packages
call:AddLP %1 en-us
call:AddLP %1 en-gb
echo - Applying Optional Components
call:AddOC %1 WinPE-MDAC
call:AddOC %1 WinPE-FMAPI
call:AddOC %1 WinPE-EnhancedStorage
call:AddOC %1 WinPE-WDS-Tools
call:AddOC %1 WinPE-RNDIS
call:AddOC %1 WinPE-Dot3Svc
call:AddOC %1 WinPE-GamingPeripherals
call:AddOC %1 WinPE-WinReCfg
call:AddOC %1 WinPE-WMI
call:AddOC %1 WinPE-SecureStartup
call:AddOC %1 WinPE-NetFX
call:AddOC %1 WinPE-Scripting
call:AddOC %1 WinPE-PowerShell
call:AddOC %1 WinPE-DismCmdlets
call:AddOC %1 WinPE-SecureBootCmdlets
call:AddOC %1 WinPE-StorageWMI
call:AddOC %1 WinPE-PlatformID
echo - Setting Language
Dism /Set-AllIntl:en-GB /Image:"%OUTPE%\mount" >> "%SystemDrive%\PE%1_log.txt"
echo - Committing changes
Dism /Unmount-Image /MountDir:"%OUTPE%\mount" /commit >> "%SystemDrive%\PE%1_log.txt"
echo Creating ISO ...
call MakeWinPEMedia /ISO "%OUTPE%" "%OUTPE%.iso"
start notepad "%SystemDrive%\PE%1_log.txt"
start powershell -EP bypass -NoE -Command "Select-String -Path '%SystemDrive%\PE%1_log.txt' -Pattern 'operation'"
echo Process complete.
goto:eof
:AddOC
echo -- Applying %2
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%2.cab" >> "%SystemDrive%\PE%1_log.txt"
set l=en-us
if exist "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" (
echo --- Applying language pack for %l%
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" >> "%SystemDrive%\PE%1_log.txt"
)
set l=en-gb
if exist "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" (
echo --- Applying language pack for %l%
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" >> "%SystemDrive%\PE%1_log.txt"
)
goto:eof
:AddLP
echo -- Applying language pack for %2
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%2\lp.cab" >> "%SystemDrive%\PE%1_log.txt"
goto:eof
:IsAdmin
%systemroot%\system32\Reg.exe query "HKU\S-1-5-19\Environment"
If Not %ERRORLEVEL% EQU 0 (
Cls & Echo You must have administrator rights to continue ...
Pause & Exit
)
Cls
goto:eof
call:IsAdmin
call "%SystemDrive%\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.bat"
call:CreatePE x86
call:CreatePE amd64
pause
goto:eof
:CreatePE
set OUTPE=%SystemDrive%\WinPE10%1
echo Copying Windows 10 PE %1 Files ...
call copype %1 "%OUTPE%" > "%SystemDrive%\PE%1_log.txt"
echo - Mounting image
Dism /Mount-Image /ImageFile:"%OUTPE%\media\sources\boot.wim" /index:1 /MountDir:"%OUTPE%\mount" >> "%SystemDrive%\PE%1_log.txt"
echo - Setting scratch space capacity
Dism /Set-ScratchSpace:512 /Image:"%OUTPE%\mount" >> "%SystemDrive%\PE%1_log.txt"
echo - Adding Language Packages
call:AddLP %1 en-us
call:AddLP %1 en-gb
echo - Applying Optional Components
call:AddOC %1 WinPE-MDAC
call:AddOC %1 WinPE-FMAPI
call:AddOC %1 WinPE-EnhancedStorage
call:AddOC %1 WinPE-WDS-Tools
call:AddOC %1 WinPE-RNDIS
call:AddOC %1 WinPE-Dot3Svc
call:AddOC %1 WinPE-GamingPeripherals
call:AddOC %1 WinPE-WinReCfg
call:AddOC %1 WinPE-WMI
call:AddOC %1 WinPE-SecureStartup
call:AddOC %1 WinPE-NetFX
call:AddOC %1 WinPE-Scripting
call:AddOC %1 WinPE-PowerShell
call:AddOC %1 WinPE-DismCmdlets
call:AddOC %1 WinPE-SecureBootCmdlets
call:AddOC %1 WinPE-StorageWMI
call:AddOC %1 WinPE-PlatformID
echo - Setting Language
Dism /Set-AllIntl:en-GB /Image:"%OUTPE%\mount" >> "%SystemDrive%\PE%1_log.txt"
echo - Committing changes
Dism /Unmount-Image /MountDir:"%OUTPE%\mount" /commit >> "%SystemDrive%\PE%1_log.txt"
echo Creating ISO ...
call MakeWinPEMedia /ISO "%OUTPE%" "%OUTPE%.iso"
start notepad "%SystemDrive%\PE%1_log.txt"
start powershell -EP bypass -NoE -Command "Select-String -Path '%SystemDrive%\PE%1_log.txt' -Pattern 'operation'"
echo Process complete.
goto:eof
:AddOC
echo -- Applying %2
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%2.cab" >> "%SystemDrive%\PE%1_log.txt"
set l=en-us
if exist "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" (
echo --- Applying language pack for %l%
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" >> "%SystemDrive%\PE%1_log.txt"
)
set l=en-gb
if exist "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" (
echo --- Applying language pack for %l%
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%l%\%2_%l%.cab" >> "%SystemDrive%\PE%1_log.txt"
)
goto:eof
:AddLP
echo -- Applying language pack for %2
Dism /Add-Package /Image:"%SystemDrive%\WinPE10%1\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\%1\WinPE_OCs\%2\lp.cab" >> "%SystemDrive%\PE%1_log.txt"
goto:eof
:IsAdmin
%systemroot%\system32\Reg.exe query "HKU\S-1-5-19\Environment"
If Not %ERRORLEVEL% EQU 0 (
Cls & Echo You must have administrator rights to continue ...
Pause & Exit
)
Cls
goto:eof


