Inital Commit

This commit is contained in:
2023-03-16 23:54:00 +01:00
commit 13ee0ecb2e
11 changed files with 227 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
PEBuilderConfig.cmd
*.iso
*.wim

View File

@@ -0,0 +1,62 @@
@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=SMBInstaller
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-SMB Installer files
xcopy /E /I /H /Y "%~dp0Overlay" "%PEPath%\mount"
REM add WMI module
Dism /Add-Package /Image:"%PEPath%\mount" /PackagePath:"%ADKPath%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"
Dism /Add-Package /Image:"%PEPath%\mount" /PackagePath:"%ADKPath%\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"
REM add WinPE-SecureStartup module
Dism /Add-Package /Image:"%PEPath%\mount" /PackagePath:"%ADKPath%\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-SecureStartup.cab"
Dism /Add-Package /Image:"%PEPath%\mount" /PackagePath:"%ADKPath%\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-SecureStartup_en-us.cab"
REM Unmount WIM image
Dism /Unmount-Image /MountDir:"%PEPath%\mount" /commit
Dism /Cleanup-Mountpoints
REM Create ISO (Disabled by default)
REM 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

View File

@@ -0,0 +1,9 @@
REM SMB config mount config for WinPEInstaller
set SmbServer=192.168.2.94
set SmbUser=.\installer
set SmbPassword=installer
set SmbFolder=WindowsInstallers
REM Used to add pefix to options in version menu,Keep tailing space
rem set "VersionPrefix=Windows 10 "
rem set "VersionPrefix=Windows 11 "

View File

@@ -0,0 +1,9 @@
REM SMB config mount config for WinPEInstaller
set SmbServer=192.168.2.94
set SmbUser=.\installer
set SmbPassword=installer
set SmbFolder=Windows10
REM Used to add pefix to options in version menu,Keep tailing space
set "VersionPrefix=Windows 10 "
rem set "VersionPrefix=Windows 11 "

View File

@@ -0,0 +1,9 @@
REM SMB config mount config for WinPEInstaller
set SmbServer=192.168.2.94
set SmbUser=.\installer
set SmbPassword=installer
set SmbFolder=Windows11
REM Used to add pefix to options in version menu,Keep tailing space
rem set "VersionPrefix=Windows 10 "
set "VersionPrefix=Windows 11 "

View File

@@ -0,0 +1,8 @@
#!ipxe
#Uses iPxe WimBoot https://ipxe.org/wimboot
kernel ${Boot-Root}/loader-wimboot/wimboot
initrd ${Boot-Root}/loader-wimboot/BCD BCD
initrd ${Boot-Root}/loader-wimboot/boot.sdi boot.sdi
initrd --name MountConfig.cmd ${Boot-Root}/Tools/MountConfigGeneric.cmd MountConfig.cmd
initrd --name boot.wim ${Boot-Root}/Tools/WinPENetInstaller.wim boot.wim
boot

View File

@@ -0,0 +1,77 @@
@ECHO OFF
TITLE Preparing installation
REM load config
call MountConfig.cmd
ECHO --------------------------------
ECHO Welcome to WinPE SMB installer
ECHO\
ECHO by Brammp
ECHO --------------------------------
ECHO\
echo Waiting for network
REM Load network
wpeinit
wpeinit network
REM Test network
:TestNetworkConnection
ping -n 1 %SmbServer% | find "TTL=" >nul
if errorlevel 1 (
goto Retry
) else (
goto ExecSMB
)
:Retry
ping 192.0.2.1 -n 5 -w 2000 >nul
goto :TestNetworkConnection
:ExecSMB
rem echo "Connection OK."
rem Mount network share
set SmbRetry=0
ECHO Waiting for SMB
:SmbMount
net use I: \\%SmbServer%\%SmbFolder% /user:%SmbUser% %SmbPassword% >null 2>&1
IF not exist I:\ (
set /A SmbRetry+=1 >null
REM ECHO SMB Failed Count: %SmbRetry%
REM ECHO Retrying in 2sec
ping 127.0.0.1 -n 5 -w 2000 >nul
GOTO SmbMount
) ELSE (
GOTO ExecMenu
)
:ExecMenu
rem Go to network share
i:
setlocal EnableDelayedExpansion
rem Show menu with availible Versions
ECHO Available releases:
ECHO\
set i=0
for /D %%f in ("*") do (
set /A i+=1
echo !i!. %VersionPrefix%%%f
set "option[!i!]=%%f"
)
ECHO\
:getChoice
set /P "choice=Enter desired option: "
if "!option[%choice%]!" equ "" echo ERROR: no such option & goto getChoice
set "SelectedRelease=!option[%choice%]!"
echo | set /p=%SelectedRelease%>%TEMP%\SelectedRelease.var
ECHO\
ECHO Loading setup for %VersionPrefix%%SelectedRelease%
ping 192.0.2.1 -n 2 -w 2000 >nul
exit

View File

@@ -0,0 +1,20 @@
@ECHO OFF
TITLE Loading windows setup
REM load needed var(s)
set /p SelectedRelease=<%TEMP%\SelectedRelease.var
set SetupFound=FALSE
REM go to setUp location
I:
cd \%SelectedRelease%
REM Check if setup exists
IF exist setup.exe (
set SetupFound=TRUE
REM load setUp
start /wait setup.exe
)
echo | set /p=%SetupFound%>%TEMP%\SetupFound.var
REM exit

View File

@@ -0,0 +1,24 @@
@ECHO OFF
TITLE Power menu
REM load needed var(s)
set /p SetupFound=<%TEMP%\SetupFound.var
IF %SetupFound% == FALSE (
echo Setup not found
pause
)
:PowerMenu
ECHO\
ECHO ...............................................
ECHO PRESS 1 to poweroff, or 2 to reboot
ECHO ...............................................
ECHO\
ECHO 1 - Poweroff
ECHO 2 - Reboot
ECHO\
SET /P M=Type 1 or 2 then press ENTER:
IF %M%==1 wpeutil shutdown
IF %M%==2 wpeutil reboot
GOTO PowerMenu

View File

@@ -0,0 +1,4 @@
[LaunchApps]
X:/SMBInstaller/InitMenu.cmd
X:/SMBInstaller/LoadSetup.cmd
X:/SMBInstaller/PowerMenu.cmd

View File

@@ -0,0 +1,2 @@
set ADKPath=C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit
set ADKVersion=W10