57 lines
1.5 KiB
Batchfile
57 lines
1.5 KiB
Batchfile
@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 |