@echo off
SET build=1.1
title MCT + WDS update tool (BETA) v%BUILD%
:: Lets set our variables, always set them before work blocks.
set prokey=W269N-WFGWX-YVC9B-4J6C9-T83GX
set entkey=NPPR9-FWDCX-D2C8J-H872K-2YT43
:checkPrivileges
:: Check for Admin by accessing protected stuff. This calls net(#).exe and can stall if we don't kill it later.
NET FILE 1>nul 2>&1 2>nul 2>&1
if '%errorlevel%' == '0' ( goto ask) else ( goto getPrivileges )
:getPrivileges
:: Write vbs in temp to call batch as admin.
if '%1'=='ELEV' (shift & goto ask)
for /f "delims=: tokens=*" %%A in ('findstr /b ::- "%~f0"') do @Echo(%%A
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
Echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
Echo UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
:ask
echo.
echo Hello, we are going to download the MCT.
Echo.
echo This only works on Windows 10 and maybe 8? and Server 2012+
echo.
echo After we are going to mount and pull the boot wim and the install esd.
echo.
echo Then we are going to list the editions we can get and convert to wim for WDS.
echo.
echo Would you like to begin?
echo.
pause
echo.
:start
cls
echo.
echo Awesome, Let me download the current MCT (2004)
echo.
echo This will get saved in your downloads folder
echo.
:: if the MCT version changes just change the link
bitsadmin /transfer MCT-2004 /download /priority FOREGROUND https://software-download.microsoft.com/download/pr/MediaCreationTool2004.exe "%userprofile%\downloads\mct.exe" >nul 2>&1
echo Cool, now lets get to business. What version do you want first?
echo.
Echo 1 = Home/Pro
Echo.
Echo 2 = Enterprise/EDU
set choice=
ECHO.
set /p choice=
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto mcthome
if '%choice%'=='2' goto mctent
goto dirwarnstart
:mcthome
cls
echo.
echo Alright, you want Home/Professional (N) lets do stuff.
echo.
echo I am going to call MCT, I will cover as many flags as I can.
echo.
echo For Home/Pro use this key when asked. (I already copied it to your clipboard.)
echo.
echo %prokey%|clip
echo %prokey%
echo.
echo Make sure to select "ISO" (Don't rename it, leave it 'Windows')
echo.
echo Save it to downloads with the MCT executable.
echo.
echo Then click "Finish"
Echo.
call "%userprofile%\downloads\mct.exe" /Eula Accept /Retail /MediaArch x64 /Download /MediaEdition Professional /Action CreateMedia
cls
echo.
echo Thanks now going to mount it.
echo.
explorer "%userprofile%\downloads\Windows.iso"
echo What is the drive letter? (Dont put dots just the letter)
echo.
set /p dltr=""
echo.
echo Thanks, I'm doing some file copies.
Echo.
echo f | xcopy "%dltr%:\sources\boot.wim" "%userprofile%\downloads\boot.wim" /y >nul 2>&1
echo f | xcopy "%dltr%:\sources\install.esd" "%userprofile%\downloads\install.esd" /y >nul 2>&1
powershell -Command "& {Dismount-DiskImage -ImagePath "%userprofile%\downloads\Windows.iso"}" >nul 2>&1
echo I dismounted the ISO for you, now its time to convert.
echo.
echo This will list the versions in this esd. Please choose only one for now.
echo.
pause
echo.
dism /Get-WimInfo /WimFile:%userprofile%\downloads\install.esd
echo.
echo please enter the "Index Number" of the image you want me to pull out.
echo.
set /p indexnum=""
echo.
echo Now tell me the version. Was it Home, Pro?
echo.
set /p indexname=""
echo.
echo Word im going to begin ripping that.
echo.
dism /export-image /SourceImageFile:%userprofile%\downloads\install.esd /SourceIndex:%indexnum% /DestinationImageFile:"%userprofile%\downloads\%indexname%".wim /Compress:max /CheckIntegrity
echo.
:: Diagnostic pause here when im manipulating names
:: pause
cls
echo.
echo All done!
echo.
echo I'm going to start cleaning these files up for you.
echo.
DEL "%userprofile%\downloads\install.esd" >nul 2>&1
DEL "%userprofile%\downloads\Windows.iso" >nul 2>&1
DEL "%userprofile%\downloads\mct.exe" >nul 2>&1
echo Done!
echo.
pause
goto mcthomedone
:mctent
cls
echo.
echo Alright, you want Enterprise/Education (N) lets do stuff.
echo.
echo I am going to call MCT, I will cover as many flags as I can.
echo.
echo For Home/Pro use this key when asked. (I already copied it to your clipboard.)
echo.
echo %entkey%|clip
echo %entkey%
echo.
echo Make sure to select "ISO" (Don't rename it, leave it 'Windows')
echo.
echo Save it to downloads with the MCT executable.
echo.
echo Then click "Finish"
Echo.
call "%userprofile%\downloads\mct.exe" /Eula Accept /Retail /MediaArch x64 /Download /MediaEdition Enterprise /Action CreateMedia
cls
echo.
echo Thanks now going to mount it.
echo.
explorer "%userprofile%\downloads\Windows.iso"
echo What is the drive letter? (Dont put dots just the letter)
echo.
set /p dltr=""
echo.
echo Thanks, I'm doing some file copies.
Echo.
echo f | xcopy "%dltr%:\sources\boot.wim" "%userprofile%\downloads\boot.wim" /y >nul 2>&1
echo f | xcopy "%dltr%:\sources\install.esd" "%userprofile%\downloads\install.esd" /y >nul 2>&1
powershell -Command "& {Dismount-DiskImage -ImagePath "%userprofile%\downloads\Windows.iso"}" >nul 2>&1
echo I dismounted the ISO for you, now its time to convert.
echo.
echo This will list the versions in this esd. Please choose only one for now.
echo.
pause
echo.
dism /Get-WimInfo /WimFile:%userprofile%\downloads\install.esd
echo.
echo please enter the "Index Number" of the image you want me to pull out.
echo.
set /p indexnum=""
echo.
echo Now tell me the version. Was it Home, Pro?
echo.
set /p indexname=""
echo.
echo Word im going to begin ripping that.
echo.
dism /export-image /SourceImageFile:%userprofile%\downloads\install.esd /SourceIndex:%indexnum% /DestinationImageFile:"%userprofile%\downloads\%indexname%".wim /Compress:max /CheckIntegrity
echo.
:: Diagnostic pause here when im manipulating names
:: pause
cls
echo.
echo All done!
echo.
echo I'm going to start cleaning these files up for you.
echo.
DEL "%userprofile%\downloads\install.esd" >nul 2>&1
DEL "%userprofile%\downloads\Windows.iso" >nul 2>&1
DEL "%userprofile%\downloads\mct.exe" >nul 2>&1
echo Done!
echo.
pause
goto mctentdone
:mcthomedone
cls
echo.
echo Want to go again?
echo.
Echo 1 = No
Echo.
Echo 2 = Yes
set choice=
ECHO.
set /p choice=
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto end
if '%choice%'=='2' goto start
goto dirwarnhome
:mctentdone
cls
echo.
echo Want to go again?
echo.
Echo 1 = No
Echo.
Echo 2 = Yes
set choice=
ECHO.
set /p choice=
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto end
if '%choice%'=='2' goto start
goto dirwarnent
:dirwarnhome
:: Key trap for selecting something out of scope.
cls
Echo "Invalid Selection Please Try again..."
Echo.
pause
goto mcthomedone
:dirwarnent
:: Key trap for selecting something out of scope.
cls
Echo "Invalid Selection Please Try again..."
Echo.
pause
goto mctentdone
:end
cls
echo.
echo Now just import your wims into WDS!
echo.
echo bye!
echo.
pause
exit