-
Notifications
You must be signed in to change notification settings - Fork 14
/
WinPEBuilder.cmd
58 lines (40 loc) · 2.84 KB
/
WinPEBuilder.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@ECHO OFF
:: Developed by: Carlos Martinez @cmartinezone Date: 1/15/2019
:: WinPEBuilder 1.0 Auto Generate WinPE ISO with drivers and script incorporate
REM Where to put Windows PE tree and ISO
Set winpe_root=%~dp0WinPE-Root
REM ADK installation path. ADK 10 can be found here: https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install
Set adk_path=%programfiles(x86)%\Windows Kits\10\Assessment and Deployment Kit
REM Drivers tree path
Set drivers_path=%~dp0Add-Drivers
REM User scripts location to include in new WinPE image. Scripts tree should include the modified startnet.cmd in which you can add your stuff
Set scripts_path=%~dp0Add-Scripts
REM Directory path for finall iso generated
set ISO_Path=%~dp0WinPE-ISO
REM Calling a script which sets some useful variables
call "%adk_path%\Deployment Tools\DandISetEnv.bat"
REM Cleaning WinPE tree
if exist %winpe_root% rd /q /s %winpe_root%
REM Calling standart script that copies WinPE tree
call copype.cmd amd64 %winpe_root%
REM Mounting WinPE wim-image
Dism /Mount-Wim /WimFile:%winpe_root%\media\sources\boot.wim /index:1 /MountDir:%winpe_root%\mount
REM Adding some useful packages. Packages description and dependencies for WinPE 10 can be found here: http://technet.microsoft.com/en-us/library/hh824926.aspx
Dism /image:%winpe_root%\mount /Add-Package /PackagePath:"%adk_path%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-HTA.cab"
Dism /image:%winpe_root%\mount /Add-Package /PackagePath:"%adk_path%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab"
Dism /image:%winpe_root%\mount /Add-Package /PackagePath:"%adk_path%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"
Dism /image:%winpe_root%\mount /Add-Package /PackagePath:"%adk_path%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFx.cab"
Dism /image:%winpe_root%\mount /Add-Package /PackagePath:"%adk_path%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab"
Dism /image:%winpe_root%\mount /Add-Package /PackagePath:"%adk_path%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-DismCmdlets.cab"
Dism /image:%winpe_root%\mount /Add-Package /PackagePath:"%adk_path%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-StorageWMI.cab"
REM Adding drivers
Dism /image:%winpe_root%\mount /Add-Driver /driver:%drivers_path% /recurse
REM Putting user scripts inside
xcopy %scripts_path% %winpe_root%\mount\Windows\System32 /r /s /e /i /y
REM Setting the timezone. List of available timezones can be found here: http://technet.microsoft.com/en-US/library/cc749073(v=ws.10).aspx
Dism /image:%winpe_root%\mount /Set-TimeZone:"Eastern Standard Time"
REM Unmounting and updating the image
Dism /Unmount-Wim /MountDir:%winpe_root%\mount\ /Commit
REM Creationg ISO image from WinPE tree
Makewinpemedia /iso /f %winpe_root% %ISO_Path%\winpe_amd64.iso
pause