From abbce7c6c0b55bd2fc6232943bd6196ede54dfdd Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 16 Mar 2023 23:50:28 +0100 Subject: [PATCH] Restructured and added buildScript --- .gitignore | 3 + Build_WinPE-ToolKit.cmd | 57 ++++++++++++++++++ .../PE-ToolKit}/DellRemoveTag/PlatTags.exe | Bin .../DellRemoveTag/PlatformTags32.exe | Bin .../DellRemoveTag/PlatformTags64.exe | Bin .../PE-ToolKit}/MainMenu.bat | 2 +- .../Windows}/System32/startnet.cmd | 0 .../Windows}/System32/winpe.jpg | Bin PEBuilderConfig.cmd.example | 2 + 9 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Build_WinPE-ToolKit.cmd rename {PE-ToolKit => Overlay/PE-ToolKit}/DellRemoveTag/PlatTags.exe (100%) rename {PE-ToolKit => Overlay/PE-ToolKit}/DellRemoveTag/PlatformTags32.exe (100%) rename {PE-ToolKit => Overlay/PE-ToolKit}/DellRemoveTag/PlatformTags64.exe (100%) rename {PE-ToolKit => Overlay/PE-ToolKit}/MainMenu.bat (94%) rename {Windows => Overlay/Windows}/System32/startnet.cmd (100%) rename {Windows => Overlay/Windows}/System32/winpe.jpg (100%) create mode 100644 PEBuilderConfig.cmd.example diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b479f33 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +PEBuilderConfig.cmd +*.iso +*.wim \ No newline at end of file diff --git a/Build_WinPE-ToolKit.cmd b/Build_WinPE-ToolKit.cmd new file mode 100644 index 0000000..d906417 --- /dev/null +++ b/Build_WinPE-ToolKit.cmd @@ -0,0 +1,57 @@ +@echo off +REM ElevationCheck +NET SESSION >nul 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + ECHO Please run this script as administrator + PAUSE + EXIT +) + +REM Buildconf +set BuildEdition=PEToolkit + +REM Setup Enviroment +REM Check if home has PEBuilderConfig if not check the current folder when no config was found quit +IF EXIST "%UserProfile%\PEBuilderConfig.cmd" ( + call %UserProfile%\PEBuilderConfig.cmd +) ELSE ( + IF EXIST "%~dp0\PEBuilderConfig.cmd" ( + call "%~dp0\PEBuilderConfig.cmd" + ) ELSE ( + echo Config not found, exiting + pause + exit + ) +) +call "%ADKPath%\Deployment Tools\DandISetEnv.bat" +set PEPath=C:\WinPE_%BuildEdition% + +REM Prepeare PE +call copype amd64 %PEPath% + +REM Mount WIM image +Dism /Mount-Image /ImageFile:"%PEPath%\media\sources\boot.wim" /index:1 /MountDir:"%PEPath%\mount" + +REM Add PE-ToolkitFiles +rem xcopy /E /I /H /Y "%~dp0Overlay\PE-ToolKit" "%PEPath%\mount\PE-ToolKit" +takeown /a /f "%PEPath%\mount\Windows\System32\winpe.jpg" +icacls "%PEPath%\mount\Windows\System32\winpe.jpg" /grant *S-1-1-0:F +xcopy /E /I /H /Y "%~dp0Overlay" "%PEPath%\mount" + +REM Unmount WIM image +Dism /Unmount-Image /MountDir:"%PEPath%\mount" /commit +Dism /Cleanup-Mountpoints + +REM Create ISO +call MakeWinPEMedia /ISO %PEPath% "%~dp0Winpe%ADKVersion%_%BuildEdition%.iso" + +REM Copy WIM File to output folder +echo Saving %~dp0Winpe%ADKVersion%_%BuildEdition%.wim +copy %PEPath%\media\sources\boot.wim %~dp0Winpe%ADKVersion%_%BuildEdition%.wim + +REM remove BuildDir +rmdir /q /s %PEPath% + +REM end +echo Done +pause \ No newline at end of file diff --git a/PE-ToolKit/DellRemoveTag/PlatTags.exe b/Overlay/PE-ToolKit/DellRemoveTag/PlatTags.exe similarity index 100% rename from PE-ToolKit/DellRemoveTag/PlatTags.exe rename to Overlay/PE-ToolKit/DellRemoveTag/PlatTags.exe diff --git a/PE-ToolKit/DellRemoveTag/PlatformTags32.exe b/Overlay/PE-ToolKit/DellRemoveTag/PlatformTags32.exe similarity index 100% rename from PE-ToolKit/DellRemoveTag/PlatformTags32.exe rename to Overlay/PE-ToolKit/DellRemoveTag/PlatformTags32.exe diff --git a/PE-ToolKit/DellRemoveTag/PlatformTags64.exe b/Overlay/PE-ToolKit/DellRemoveTag/PlatformTags64.exe similarity index 100% rename from PE-ToolKit/DellRemoveTag/PlatformTags64.exe rename to Overlay/PE-ToolKit/DellRemoveTag/PlatformTags64.exe diff --git a/PE-ToolKit/MainMenu.bat b/Overlay/PE-ToolKit/MainMenu.bat similarity index 94% rename from PE-ToolKit/MainMenu.bat rename to Overlay/PE-ToolKit/MainMenu.bat index e54e98c..d882c42 100644 --- a/PE-ToolKit/MainMenu.bat +++ b/Overlay/PE-ToolKit/MainMenu.bat @@ -1,5 +1,5 @@ @ECHO OFF - +TITLE WinPE Toolkit REM ################################################################## REM # # REM # @description: # diff --git a/Windows/System32/startnet.cmd b/Overlay/Windows/System32/startnet.cmd similarity index 100% rename from Windows/System32/startnet.cmd rename to Overlay/Windows/System32/startnet.cmd diff --git a/Windows/System32/winpe.jpg b/Overlay/Windows/System32/winpe.jpg similarity index 100% rename from Windows/System32/winpe.jpg rename to Overlay/Windows/System32/winpe.jpg diff --git a/PEBuilderConfig.cmd.example b/PEBuilderConfig.cmd.example new file mode 100644 index 0000000..bb4cc23 --- /dev/null +++ b/PEBuilderConfig.cmd.example @@ -0,0 +1,2 @@ +set ADKPath=C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit +set ADKVersion=W10 \ No newline at end of file