Latest Addition ==> Bob.Omb's Modified Win10PEx64 v4.8 - RS5

Author Topic: WinNTSetup3  (Read 839 times)

Bob.Omb

  • PE Baker
  • Administrator
  • Jr. Member
  • *****
  • Posts: 85
    • View Profile
WinNTSetup3
« on: September 15, 2018, 08:40:35 pm »
This is an awesome tool! You can install windows in minutes (2 minutes with SSD and USB 3.0)



You can get the latest version here: http://jfx.cwcodes.net/WinNTSetup/Release/WinNTSetup3.rar

I also use a batch script to launch WinNTSetupx64 to make it easier to use.  It prepares the drives for you in either MBR or GPT format.  Then imports the drive letters into the appropriate fields so that all you have to do is select the iso and your edition of windows.  The batch script FORMATS the selected drive, if you use it, be careful which drive you are selecting

Copy the below code and save it to a .BAT or .CMD file, and place it in the same directory as WinNTSetup_x64.exe

Code: [Select]
@ECHO OFF
CLS
CD %~dp0
IF EXIST GPT.ini DEL GPT.ini
IF EXIST MBR.ini DEL MBR.ini
IF EXIST tempgpt.ini DEL tempgpt.ini
IF EXIST tempmbr.ini DEL tempmbr.ini
TITLE Prepare Disk for WinNTSetup3
:PRIVILEGECHECK
NET SESSION >nul 2>&1
IF %errorlevel% == 0 (
GOTO SELECTTYPE
) else (
GOTO GETPRIVILEGE
)
:NOPRIVILEGE
ECHO        Prepare Hard Disks for WinNTSetup3 GPT or MBR
ECHO -----------------------------------------------------------
ECHO           Warning, Elevated Privilege is Required
ECHO.                                       
ECHO                 RE-OPEN AS AN ADMINISTRATOR       
ECHO                  THE PROGRAM WILL NOW EXIT
ECHO.
ECHO -----------------------------------------------------------
ECHO.
PAUSE
EXIT
:GETPRIVILEGE
SET "params=%*"
SETLOCAL EnableDelayedExpansion
CD /d "%~dp0" && ( IF EXIST "%temp%\getadmin.vbs" DEL "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>NUL 2>NUL || (  ECHO Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k CD ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && EXIT /B )
GOTO NOPRIVILEGE
:SELECTTYPE
ECHO Prepare Hard Disk for WinNTSetup3 GPT or MBR
ECHO --------------------------------------------
ECHO.
CHOICE /C MG /M "Are you setting up for MBR or GPT "
IF %ERRORLEVEL% == 1 GOTO INITMBR
IF %ERRORLEVEL% == 2 GOTO INITGPT
ECHO.
ECHO Invalid selection! Please choose a valid selection.
ECHO.
PAUSE
GOTO SELECTTYPE
EXIT
:INITMBR
CLS
ECHO Prepare Hard Disk for WinNTSetup3 (MBR)
ECHO --------------------------------------------
ECHO.
ECHO list disk >> list.txt
diskpart /s list.txt
DEL list.txt>nul
ECHO.
SET /p disk="Which disk number would you like to prepare? (e.g. 0): "
IF [%DISK%] == [] GOTO INITMBR
ECHO.
ECHO --WARNING-- This will FORMAT the selected disk and ERASE ALL DATA
ECHO.
ECHO You selected disk ---^> %disk%
ECHO.
CHOICE /C YN /M "Is this correct "
IF %ERRORLEVEL% == 1 GOTO INITMBR2
CLS
ECHO Preperation Aborted, No changes have been made...
ECHO.
PAUSE
EXIT
:INITMBR2
SET "a="
FOR %%a IN (Z Y X W V U T S R Q P O N M) DO (
IF NOT EXIST "%%a:" SET BOOTDRV=%%a
)
ECHO sel dis %disk% >> initmbr.txt
ECHO clean >>initmbr.txt
ECHO convert mbr >> initmbr.txt
ECHO cre par pri >> initmbr.txt
ECHO for quick fs=ntfs label="Windows" >> initmbr.txt
ECHO assign letter %BOOTDRV% >> initmbr.txt
ECHO active >> initmbr.txt
ECHO exit >> initmbr.txt
:RUNMBR
CLS
diskpart /s initmbr.txt
DEL initmbr.txt >nul
ECHO.
ECHO This drive is now prepared for WinNTSetup3 - MBR\Legacy
ECHO.
ECHO The following drive letters have been assigned, and
ECHO will be automatically loaded into WinNTSetup3
ECHO.
ECHO Boot Drive----------: %BOOTDRV%
ECHO Installation Drive--: %BOOTDRV%
ECHO.
PAUSE
ECHO.
ECHO Please wait while WinNTSetup3 loads...
CD %~dp0
powershell -Command "(gc template.ini) -replace 'BootDest=changeme', 'BootDest=%BOOTDRV%:' | Out-File tempmbr.ini"
powershell -Command "(gc tempmbr.ini) -replace 'TempDest=changeme', 'TempDest=%BOOTDRV%:' | Out-File MBR.ini"
CD ..
START winntsetup_x64.exe /cfg:prep\MBR.ini
EXIT
:INITGPT
CLS
ECHO Prepare Hard Disk for WinNTSetup3 (GPT)
ECHO --------------------------------------------
ECHO.
ECHO list disk >> list.txt
diskpart /s list.txt
DEL list.txt>nul
ECHO.
SET /p disk="Which disk number would you like to prepare? (e.g. 0): "
IF [%disk%] == [] GOTO INITGPT
ECHO.
ECHO --WARNING-- This will FORMAT the selected disk and ERASE ALL DATA
ECHO.
ECHO You selected disk ---^> %disk%
ECHO.
CHOICE /C YN /M "Is this correct "
IF %ERRORLEVEL% == 1 GOTO INITGPT2
CLS
ECHO Preperation Aborted, No changes have been made...
ECHO.
PAUSE
EXIT
:INITGPT2
SET "b="
FOR %%b IN (Q P O N M L K J I) DO (
IF NOT EXIST "%%b:" SET BOOTDRV=%%b
)
SET "c="
FOR %%c IN (Z Y X W V U T S R) DO (
IF NOT EXIST "%%c:" SET DATADRV=%%c
)
ECHO select disk %disk% >> initgpt.txt
ECHO clean >> initgpt.txt
ECHO convert gpt >> initgpt.txt
ECHO cre par efi size=100 >> initgpt.txt
ECHO for quick fs=fat32 label="System" >> initgpt.txt
ECHO assign letter %BOOTDRV% >> initgpt.txt
ECHO cre par msr size=16 >> initgpt.txt
ECHO cre par pri >> initgpt.txt
ECHO shrink minimum=450 >> initgpt.txt
ECHO for quick fs=ntfs label="Windows" >> initgpt.txt
ECHO assign letter %DATADRV% >> initgpt.txt
ECHO cre par pri >> initgpt.txt
ECHO for quick fs=ntfs label="WinRE" >> initgpt.txt
ECHO set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" >> initgpt.txt
:RUNGPT
CLS
diskpart /s initgpt.txt
DEL initgpt.txt >nul
ECHO.
ECHO This drive is now prepared for WinNTSetup3 - GPT\UEFI
ECHO.
ECHO The following drive letters have been assigned, and
ECHO will be automatically loaded into WinNTSetup3
ECHO.
ECHO Boot Drive----------: %BOOTDRV%
ECHO Installation Drive--: %DATADRV%
ECHO.
PAUSE
ECHO.
ECHO Please wait while WinNTSetup3 loads...
CD %~dp0
powershell -Command "(gc template.ini) -replace 'BootDest=changeme', 'BootDest=%BOOTDRV%:' | Out-File tempgpt.ini"
powershell -Command "(gc tempgpt.ini) -replace 'TempDest=changeme', 'TempDest=%DATADRV%:' | Out-File GPT.ini"
CD ..
START winntsetup_x64.exe /cfg:prep\GPT.ini
EXIT
« Last Edit: September 16, 2018, 12:28:34 pm by Bob.Omb »

bigbadmoshe

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: WinNTSetup3
« Reply #1 on: January 17, 2019, 02:33:38 am »
I wanted you to look at a modified version of your script.

Have any pointers?

Code: [Select]
@ECHO OFF
CLS
ECHO -----------------------------------------------------------
ECHO Checking to see if the PC is booted in BIOS or UEFI mode.
wpeutil UpdateBootInfo
for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET Firmware=%%B
ECHO            Note: delims is a TAB followed by a space.
IF x%Firmware%==x ECHO ERROR: Can't figure out which firmware we're on.
IF x%Firmware%==x ECHO        Common fix: In the command above:
IF x%Firmware%==x ECHO             for /f "tokens=2* delims= "
IF x%Firmware%==x ECHO        ...replace the spaces with a TAB character followed by a space.
IF x%Firmware%==x GOTO END
IF %Firmware%==0x1 ECHO The PC is booted in BIOS mode.
IF %Firmware%==0x2 ECHO The PC is booted in UEFI mode.
ECHO -----------------------------------------------------------
CD %~dp0
IF EXIST GPT.ini DEL GPT.ini
IF EXIST MBR.ini DEL MBR.ini
IF EXIST tempgpt.ini DEL tempgpt.ini
IF EXIST tempmbr.ini DEL tempmbr.ini
TITLE Prepare Disk for WinNTSetup3
:PRIVILEGECHECK
NET SESSION >nul 2>&1
IF %errorlevel% == 0 (
GOTO SELECTTYPE
) else (
GOTO GETPRIVILEGE
)
:NOPRIVILEGE
ECHO        Prepare Hard Disk for WinNTSetup3 GPT (UEFI) or MBR (BIOS)
ECHO -----------------------------------------------------------
ECHO           Warning, Elevated Privilege is Required
ECHO.
ECHO                 RE-OPEN AS AN ADMINISTRATOR
ECHO                  THE PROGRAM WILL NOW EXIT
ECHO.
ECHO -----------------------------------------------------------
ECHO.
PAUSE
EXIT
:GETPRIVILEGE
SET "params=%*"
SETLOCAL EnableDelayedExpansion
CD /d "%~dp0" && ( IF EXIST "%temp%\getadmin.vbs" DEL "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>NUL 2>NUL || (  ECHO Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k CD ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && EXIT /B )
GOTO NOPRIVILEGE
:SELECTTYPE
ECHO Prepare Hard Disk for WinNTSetup3 GPT (UEFI) or MBR (BIOS)
ECHO Please note: Only Windows x64 Will work with GPT
ECHO -----------------------------------------------------------
ECHO.
CHOICE /C MG /M "Are you setting up for MBR or GPT "
IF %ERRORLEVEL% == 1 GOTO INITMBR
IF %ERRORLEVEL% == 2 GOTO INITGPT
ECHO.
ECHO Invalid selection! Please choose a valid selection.
ECHO.
PAUSE
GOTO SELECTTYPE
EXIT
:INITMBR
CLS
ECHO Prepare Hard Disk for WinNTSetup3 MBR (BIOS)
ECHO -----------------------------------------------------------
ECHO.
ECHO list disk >> list.txt
diskpart /s list.txt
DEL list.txt>nul
ECHO.
SET /p disk="Which disk number would you like to prepare? (e.g. 0): "
IF [%DISK%] == [] GOTO INITMBR
ECHO.
ECHO --WARNING-- This will FORMAT the selected disk and ERASE ALL DATA
ECHO.
ECHO You selected disk ---^> %disk%
ECHO.
CHOICE /C YN /M "Is this correct "
IF %ERRORLEVEL% == 1 GOTO INITMBR2
CLS
ECHO Preperation Aborted, No changes have been made...
ECHO.
PAUSE
EXIT
:INITMBR2
SET BOOTDRV="S"
SET DATADRV="W"
ECHO sel dis %disk% >> initmbr.txt
ECHO clean >> initmbr.txt
ECHO convert mbr >> initmbr.txt
rem == 1. System partition ======================
ECHO create partition primary size=350 >> initmbr.txt
ECHO format quick fs=ntfs label="System" >> initmbr.txt
ECHO assign letter=%BOOTDRV% >> initmbr.txt
ECHO active >> initmbr.txt
rem == 2. Windows partition =====================
rem ==    a. Create the Windows partition =======
ECHO create partition primary >> initmbr.txt
rem ==    b. Create space for the recovery image
ECHO shrink minimum=500 >> initmbr.txt
rem          ** Note, adjust the size to match
rem             the size of the recovery image.
rem ==    c. Prepare the Windows partition ======
ECHO format quick fs=ntfs label="Windows" >> initmbr.txt
ECHO assign letter %DATADRV% >> initmbr.txt
rem == 3. Recovery image partition ==============
ECHO create partition primary >> initmbr.txt
ECHO format quick fs=ntfs label="Recovery image" >> initmbr.txt
ECHO assign letter="R" >> initmbr.txt
ECHO set id=27 >> initmbr.txt
ECHO exit >> initmbr.txt
:RUNMBR
CLS
diskpart /s initmbr.txt
DEL initmbr.txt >nul
ECHO.
ECHO This drive is now prepared for WinNTSetup3 - MBR (BIOS)
ECHO.
ECHO The following drive letters have been assigned, and
ECHO will be automatically loaded into WinNTSetup3
ECHO.
ECHO Boot Drive----------: %BOOTDRV%
ECHO Installation Drive--: %DATADRV%
ECHO.
PAUSE
ECHO.
ECHO Please wait while WinNTSetup3 loads...
CD %~dp0
CD ..
START winntsetup_x64.exe /cfg:prep\template.ini
GOTO WINRE
:INITGPT
CLS
ECHO Prepare Hard Disk for WinNTSetup3 GPT (UEFI)
ECHO -----------------------------------------------------------
ECHO.
ECHO list disk >> list.txt
diskpart /s list.txt
DEL list.txt>nul
ECHO.
SET /p disk="Which disk number would you like to prepare? (e.g. 0): "
IF [%disk%] == [] GOTO INITGPT
ECHO.
ECHO --WARNING-- This will FORMAT the selected disk and ERASE ALL DATA
ECHO.
ECHO You selected disk ---^> %disk%
ECHO.
CHOICE /C YN /M "Is this correct "
IF %ERRORLEVEL% == 1 GOTO INITGPT2
CLS
ECHO Preperation Aborted, No changes have been made...
ECHO.
PAUSE
EXIT
:INITGPT2
SET BOOTDRV="S"
SET DATADRV="W"
ECHO select disk %disk% >> initgpt.txt
ECHO clean >> initgpt.txt
ECHO convert gpt >> initgpt.txt
rem == 1. System partition =========================
ECHO cre par efi size=100 >> initgpt.txt
rem    ** NOTE: For Advanced Format 4Kn drives,
rem               change this value to size = 260 **
ECHO for quick fs=fat32 label="System" >> initgpt.txt
ECHO assign letter %BOOTDRV% >> initgpt.txt
rem == 2. Microsoft Reserved (MSR) partition =======
ECHO cre par msr size=16 >> initgpt.txt
rem == 3. Windows partition ========================
rem ==    a. Create the Windows partition ==========
ECHO cre par pri >> initgpt.txt
rem ==    b. Create space for the recovery tools ===
ECHO shrink minimum=500 >> initgpt.txt
rem       ** NOTE: Update this size to match the
rem                size of the recovery tools
rem                (winre.wim)                    **
rem ==    c. Prepare the Windows partition =========
ECHO for quick fs=ntfs label="Windows" >> initgpt.txt
ECHO assign letter %DATADRV% >> initgpt.txt
rem === 4. Recovery partition ======================
ECHO cre par pri >> initgpt.txt
ECHO for quick fs=ntfs label="Recovery" >> initgpt.txt
ECHO assign letter="R" >> initgpt.txt
ECHO set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" >> initgpt.txt
ECHO gpt attributes=0x8000000000000001 >> initgpt.txt
ECHO exit >> initgpt.txt
:RUNGPT
CLS
diskpart /s initgpt.txt
DEL initgpt.txt >nul
ECHO.
ECHO This drive is now prepared for WinNTSetup3 - GPT (UEFI)
ECHO.
ECHO The following drive letters have been assigned, and
ECHO will be automatically loaded into WinNTSetup3
ECHO.
ECHO Boot Drive----------: %BOOTDRV%
ECHO Installation Drive--: %DATADRV%
ECHO.
PAUSE
ECHO.
ECHO Please wait while WinNTSetup3 loads...
CD %~dp0
CD ..
START winntsetup_x64.exe /cfg:prep\template.ini
ECHO.
:WINRE
ECHO Configure Windows Recovery Enviroment
ECHO -----------------------------------------------------------
ECHO.
CHOICE /C YN /M "Setup Windows Recovery Enviroment"
IF %ERRORLEVEL% == 1 GOTO INITWINRE
CLS
ECHO Configuration Aborted, No changes have been made...
ECHO.
PAUSE
EXIT
:INITWINRE
ECHO finding the Windows Drive
ECHO -------------------------
@IF EXIST C:\Windows SET windowsdrive=C:\
@IF EXIST D:\Windows SET windowsdrive=D:\
@IF EXIST E:\Windows SET windowsdrive=E:\
@IF EXIST W:\Windows SET windowsdrive=W:\
ECHO The Windows drive is %windowsdrive%
md R:\Recovery\WindowsRE
ECHO -------------------
ECHO Finding Winre.wim
@IF EXIST %windowsdrive%Recovery\WindowsRE\winre.wim SET recoveryfolder=%windowsdrive%Recovery\WindowsRE\
@IF EXIST %windowsdrive%Windows\System32\Recovery\winre.wim SET recoveryfolder=%windowsdrive%Windows\System32\Recovery\
ECHO -----------------------------------------------------------
ECHO copying Winre.wim
xcopy /h %recoveryfolder%Winre.wim R:\Recovery\WindowsRE\
ECHO -----------------------------------------------------------
ECHO  == Register the location of the recovery tools ==
%windowsdrive%Windows\System32\Reagentc /Setreimage /Path R:\Recovery\WindowsRE /Target %windowsdrive%Windows
ECHO
ECHO == Verify the configuration status of the images. ==
%windowsdrive%Windows\System32\Reagentc /Info /Target %windowsdrive%Windows
ECHO   (Note: Windows RE status may appear as Disabled, this is OK.)
ECHO -----------------------------------------------------------
CHOICE /C YN /M "Would You like To Exit"
:END

Bob.Omb

  • PE Baker
  • Administrator
  • Jr. Member
  • *****
  • Posts: 85
    • View Profile
Re: WinNTSetup3
« Reply #2 on: January 17, 2019, 07:18:01 pm »
It looks good.  I am working on better available drive letter detection. I will post an updated version soon.