[REQ] $OEM$ Folder w/Scripts for Auto-activation / OEM Branding with User Choice

Discussion in 'Scripting' started by Mr.X, Nov 21, 2014.

  1. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    #61 Mr.X, Nov 23, 2014
    Last edited: Nov 23, 2014
    (OP)
    Afterwards the above post of cerberus, yesterday we, cerberus and I, spent 3-4 hours running some experimental tests trying to make OEM branding to correctly apply the proper aero theme with no success, so he reach the conclusion that OEM Branding must be applied at oobe stage not at the next stage, local user account creation.
    I guess then, OEM branding will be applied without user interaction/option. I'm going to edit my scripts and run another sets of tests and see what happens. :cool:
     
  2. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    Every OS is different and that is part of the problem...what works for one doesn't always work for another. Dang dll file. lol
     
  3. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    #63 Mr.X, Nov 23, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    LOL In this precise moment I managed my issue cerberus... :cool:

    Take a look at the red parts of the script:

    boottask.cmd
    Code:
    @echo off
    setlocal ENABLEDELAYEDEXPANSION
    pushd "%~dp0"
    cd %~dp0
    ::===============================================================================================================
    ::OEM BRANDING
    :Choice1
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Run OEM Branding ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :OEMBranding
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice2
    :OEMBranding
    cls
    echo --------------------------------------------------------------------------------
    echo OEM BRANDING
    echo --------------------------------------------------------------------------------
    echo:
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: 'OOBE.cmd' -> 'Windows 10' • 'Windows 8.x' • 'Windows 7' • 'Windows Vista' : Nov 18|2014 :
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    SET EDITION=&SET CSNAME=&SET CSVENDOR=&SET SYSMODEL=&SET SYSMNF=&SET BASEPRO=&SET BASEMNF=&SET BIOVER=&SET MAN=DEFAULT&SET MAN2=&SET PIDKEY=&SET REALMAN=&SET WINVER=&SET INFO=INFO&SET LAST=LAST&SET INL=IF NOT ERRORLEVEL 1&SET RESLN=&SET SLIC=SLIC
    SET OEMS=%windir%\Setup\scripts\oemscan.ini&SET RQR1=REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"&SET RQR2=REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionId"
    :OS
    ::check • set 'Windows OS' -> '10|8.x|7|Vista' ('findstr' -> word start|end '\<','\>')
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<PREVIEW\>" >nul&&%INL% SET WINVER=10&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<10\>" >nul&&%INL% SET WINVER=10&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<8\>" >nul&&%INL% SET WINVER=8&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<7\>" >nul&&%INL% SET WINVER=7&goto :EDITION
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<VISTA\>" >nul&&%INL% SET WINVER=VISTA&goto :EDITION
    :EDITION
    ::check • set 'Windows Edition' -> 'ULTIMATE|BUSINESS|PROFESSIONAL|HOMEPREMIUM|HOMEBASIC|STARTER' ('findstr' -> word start|end '\<','\>')
    %RQR2% | findstr /I "\<ULTIMATE\>" >nul&&%INL% SET EDITION=ULTIMATE&goto :BIOS
    %RQR2% | findstr /I "\<BUSINESS\>" >nul&&%INL% SET EDITION=BUSINESS&goto :BIOS
    %RQR2% | findstr /I "\<PROFESSIONAL\>" >nul&&%INL% SET EDITION=PROFESSIONAL&goto :BIOS
    %RQR2% | findstr /I "\<HOMEPREMIUM\>" >nul&&%INL% SET EDITION=HOMEPREMIUM&goto :BIOS
    %RQR2% | findstr /I "\<HOMEBASIC\>" >nul&&%INL% SET EDITION=HOMEBASIC&goto :BIOS
    %RQR2% | findstr /I "\<STARTER\>" >nul&&%INL% SET EDITION=STARTER&goto :BIOS
    :BIOS
    ::check • set 'Manufacturer Name' from 'CSPRODUCT|COMPUTERSYSTEM|BASEBOARD|BIOS' ID's -> filter 'results' via oemscan.ini
    for /f "tokens=2 delims==" %%A in ('"WMIC CSPRODUCT GET NAME /format:list"') do %INL% (set CSNAME=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC CSPRODUCT GET VENDOR /format:list"') do %INL% (set CSVENDOR=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC COMPUTERSYSTEM GET MODEL /format:list"') do %INL% (set SYSMODEL=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC COMPUTERSYSTEM GET MANUFACTURER /format:list"') do %INL% (set SYSMNF=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC BASEBOARD GET PRODUCT /format:list"') do %INL% (set BASEPRO=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC BASEBOARD GET MANUFACTURER /format:list"') do %INL% (set BASEMNF=%%A)
    for /f "tokens=2 delims== " %%A in ('"WMIC BIOS GET VERSION /format:list"') do %INL% (set BIOVER=%%A)
    :FILTER
    ::check • filter 'results' ('findstr' specific list order -> word start|end '\<','\>') -> by-pass 'void|conflict' entries
    SET VOID1=To Be Filled By O.E.M.&SET VOID2=System Product Name&SET VOID3=System manufacturer&SET VOID4=Base Board Product Name&SET VOID5=Intel Corporation
    :CHECK1
    IF DEFINED VOID1 IF /I "%CSNAME%"=="%VOID1%" (goto :CHECK2) else IF DEFINED VOID2 IF /I "%CSNAME%"=="%VOID2%" (goto :CHECK2) else IF DEFINED VOID3 IF /I "%CSNAME%"=="%VOID3%" (goto :CHECK2) else IF DEFINED VOID4 IF /I "%CSNAME%"=="%VOID4%" (goto :CHECK2) else IF DEFINED VOID5 IF /I "%CSNAME%"=="%VOID5%" (goto :CHECK2)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%CSNAME%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK2
    IF DEFINED VOID1 IF /I "%SYSMODEL%"=="%VOID1%" (goto :CHECK3) else IF DEFINED VOID2 IF /I "%SYSMODEL%"=="%VOID2%" (goto :CHECK3) else IF DEFINED VOID3 IF /I "%SYSMODEL%"=="%VOID3%" (goto :CHECK3) else IF DEFINED VOID4 IF /I "%SYSMODEL%"=="%VOID4%" (goto :CHECK3) else IF DEFINED VOID5 IF /I "%SYSMODEL%"=="%VOID5%" (goto :CHECK3)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%SYSMODEL%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK3
    IF DEFINED VOID1 IF /I "%BASEPRO%"=="%VOID1%" (goto :CHECK4) else IF DEFINED VOID2 IF /I "%BASEPRO%"=="%VOID2%" (goto :CHECK4) else IF DEFINED VOID3 IF /I "%BASEPRO%"=="%VOID3%" (goto :CHECK4) else IF DEFINED VOID4 IF /I "%BASEPRO%"=="%VOID4%" (goto :CHECK4) else IF DEFINED VOID5 IF /I "%BASEPRO%"=="%VOID5%" (goto :CHECK4)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%BASEPRO%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK4
    IF DEFINED VOID1 IF /I "%CSVENDOR%"=="%VOID1%" (goto :CHECK5) else IF DEFINED VOID2 IF /I "%CSVENDOR%"=="%VOID2%" (goto :CHECK5) else IF DEFINED VOID3 IF /I "%CSVENDOR%"=="%VOID3%" (goto :CHECK5) else IF DEFINED VOID4 IF /I "%CSVENDOR%"=="%VOID4%" (goto :CHECK5) else IF DEFINED VOID5 IF /I "%CSVENDOR%"=="%VOID5%" (goto :CHECK5)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%CSVENDOR%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK5
    IF DEFINED VOID1 IF /I "%SYSMNF%"=="%VOID1%" (goto :CHECK6) else IF DEFINED VOID2 IF /I "%SYSMNF%"=="%VOID2%" (goto :CHECK6) else IF DEFINED VOID3 IF /I "%SYSMNF%"=="%VOID3%" (goto :CHECK6) else IF DEFINED VOID4 IF /I "%SYSMNF%"=="%VOID4%" (goto :CHECK6) else IF DEFINED VOID5 IF /I "%SYSMNF%"=="%VOID5%" (goto :CHECK6)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%SYSMNF%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK6
    IF DEFINED VOID1 IF /I "%BIOVER%"=="%VOID1%" (goto :CHECKOUT) else IF DEFINED VOID2 IF /I "%BIOVER%"=="%VOID2%" (goto :CHECKOUT) else IF DEFINED VOID3 IF /I "%BIOVER%"=="%VOID3%" (goto :CHECKOUT) else IF DEFINED VOID4 IF /I "%BIOVER%"=="%VOID4%" (goto :CHECKOUT) else IF DEFINED VOID5 IF /I "%BIOVER%"=="%VOID5%" (goto :CHECKOUT)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%SLIC%%\>" ^| findstr /I "\<%%BIOVER%%\>"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECKOUT
    REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VMware\>" >nul&&%INL% goto :SETKEY
    REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VirtualBox\>" >nul&&%INL% goto :SETKEY
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%BASEMNF%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :SETKEY
    ::set 'genuine' activation -> use bios version id (if detected), bios may be modded|shared (ie.'Dell PC' - bios mod 'ACRSYS-Acer'; etc) -> ('findstr' -> word start|end '\<','\>')
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%SLIC%%\>" ^| findstr /I "\<%%BIOVER%%\>"') do (set MAN2=%%c)
    IF /I "%MAN%"=="DEFAULT" REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VMware\>" >nul&&%INL% SET MAN=VMWARE
    IF /I "%MAN%"=="DEFAULT" REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VirtualBox\>" >nul&&%INL% SET MAN=VBOX
    IF /I "%MAN2%"=="GATEWAY" IF /I "%MAN%"=="EMACHINES" SET MAN2=EMACHINES&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="EMACHINES" SET MAN2=EMACHINES&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="GATEWAY" SET MAN2=GATEWAY&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="PBELL" SET MAN2=PBELL&goto :SERIAL
    IF /I "%MAN2%"=="HP" IF /I "%MAN%"=="COMPAQ" SET MAN2=COMPAQ&goto :SERIAL
    IF /I "%MAN2%"=="LENOVO" IF /I "%MAN%"=="IBM" SET MAN2=IBM&goto :SERIAL
    IF NOT DEFINED MAN2 SET MAN2=%MAN%&goto :SERIAL
    :SERIAL
    ::scan 'oemscan.ini' once with the provided 'Manufacturer|OS|Edition' -> if not matched, set the manufacturer (serial) to 'DEFAULTOEM' (Acer) & try again -> ('findstr' -> word start|end '\<','\>')
    IF /I "%WINVER%"=="10" GOTO :WIN810
    IF /I "%WINVER%"=="8" GOTO :WIN810
    IF NOT DEFINED WINVER GOTO :BRANDING
    IF NOT DEFINED EDITION GOTO :BRANDING
    IF EXIST %OEMS% for /f "tokens=1,2,3,4 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%EDITION%%\>" ^| findstr /I "\<%%MAN2%%\>"') do (echo %%a | findstr /I "\<%WINVER%\>" >nul &&%INL% set PIDKEY=%%d)
    IF NOT DEFINED PIDKEY set REALMAN=%MAN2%&set MAN2=DEFAULTOEM&goto :SERIAL
    IF /I "%MAN2%"=="DEFAULTOEM" set MAN2=%REALMAN%
    :ACTIVATION
    ::create 'activate.cmd' -> 'CALL' -> from 'OOBE.cmd' for 'WIN7' or 'SetupComplete.cmd' for 'VISTA'
    (echo @echo off & echo. & echo :ACTIVATE & echo ::apply serial:: & echo cscript //nologo %windir%\system32\slmgr.vbs -ipk %PIDKEY% ^>^nul & echo ::apply certificate ^& 2nd, 3rd, 4th, etc, if available::
    echo IF EXIST "%windir%\Setup\scripts\Certificates\%MAN2%.xrm-ms" for /f "tokens=*" %%%%A in ^('DIR /B "%windir%\Setup\scripts\Certificates\%MAN2%*.xrm-ms"'^) DO ^(
    echo cscript //nologo %windir%\system32\slmgr.vbs -ilc "%windir%\Setup\scripts\Certificates\%%%%A" ^>^nul^) & echo IF EXIST "%windir%\Setup\scripts\oemscan.ini" DEL /F /Q "%windir%\Setup\scripts\oemscan.ini" ^>^nul
    echo IF EXIST "%windir%\Setup\scripts\Certificates\" DEL /S /F /Q "%windir%\Setup\scripts\Certificates\*.*" ^>^nul ^&^& RD /S /Q "%windir%\Setup\scripts\Certificates" ^>^nul) >"%windir%\Setup\scripts\activate.cmd"
    IF /I NOT "%WINVER%"=="VISTA" GOTO :OOBE
    ::'VISTA only' check 'SetupComplete.cmd' exists -> 'NO' rename|edit 'activate.cmd' -> 'YES' -> edit existing 'SetupComplete.cmd'
    IF NOT EXIST %windir%\Setup\scripts\SetupComplete.cmd (move /Y %windir%\Setup\scripts\activate.cmd %windir%\Setup\scripts\no4.txt >nul
    (echo RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >%windir%\Setup\scripts\no3.txt 
    copy /b %windir%\Setup\scripts\no4.txt+%windir%\Setup\scripts\no3.txt %windir%\Setup\scripts\SetupComplete.cmd >nul & del /F /Q %windir%\Setup\scripts\no4.txt >nul %windir%\Setup\scripts\no3.txt >nul
    ) ELSE (Type %windir%\Setup\scripts\SetupComplete.cmd | findstr /I /V /C:"@echo off" >%windir%\Setup\scripts\no2.txt && del /F /Q %windir%\Setup\scripts\SetupComplete.cmd >nul
    (echo @echo off & echo. & echo IF EXIST %windir%\Setup\scripts\activate.cmd CALL %windir%\Setup\scripts\activate.cmd ^>^nul ^&^& DEL /F /Q %windir%\Setup\scripts\activate.cmd ^>^nul) >%windir%\Setup\scripts\no1.txt 
    copy /b %windir%\Setup\scripts\no1.txt+%windir%\Setup\scripts\no2.txt %windir%\Setup\scripts\SetupComplete.cmd >nul & del /F /Q %windir%\Setup\scripts\no1.txt >nul %windir%\Setup\scripts\no2.txt >nul)
    GOTO :BRANDING
    :WIN810
    %windir%\Setup\scripts\Rw.exe /Min /NoLogo /command="ACPI Dump MSDM";"RwExit" /logfile=%windir%\Setup\scripts\msdm.log
    for /f "Skip=1 tokens=2 delims=    " %%A in ('find "-" %windir%\Setup\scripts\msdm.log') do %INL% set DM=%%A
    cscript //B %windir%\system32\slmgr.vbs /ipk %DM% >nul
    cscript //B %windir%\system32\slmgr.vbs /ato >nul
    IF EXIST "%windir%\Setup\scripts\msdm.log" DEL /F /Q "%windir%\Setup\scripts\msdm.log" >nul
    GOTO :BRANDING
    :OOBE
    ::check • apply created 'activate.cmd' -> from this 'OOBE.cmd'
    IF EXIST %windir%\Setup\scripts\activate.cmd cd /d %windir%\Setup\scripts\ && CALL "activate.cmd" >nul
    IF EXIST %windir%\Setup\scripts\activate.cmd DEL /F /Q %windir%\Setup\scripts\activate.cmd >nul
    :BRANDING
    ::check • set 'MAN=?' -> if exist 'Force_Theme_[readme].txt' || edit brand '.reg file' -> if installing 'Starter' Edition
    IF EXIST "%windir%\Setup\scripts\Rw.exe" DEL /F /Q "%windir%\Setup\scripts\Rw.exe" >nul
    cd /d %windir%\Setup\scripts\OEM's\ && for /r %%G in (.) DO IF EXIST %%G\Force_Theme_[readme].txt DEL /F /Q %%G\Force_Theme_[readme].txt >nul &&set MAN=%%~nG
    IF EXIST "%windir%\Setup\scripts\Force_Theme_[readme].txt" DEL /F /Q "%windir%\Setup\scripts\Force_Theme_[readme].txt" >nul
    IF /I NOT "%EDITION%"=="STARTER" GOTO :CONTINUE
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" (cd /d %windir%\Setup\scripts\OEM's\%MAN%\ >nul & Type %MAN%.reg | findstr /I /V "InstallTheme" >STARTER.reg && MOVE /Y "STARTER.reg" "%MAN%.reg" >nul)
    :CONTINUE
    ::finalize branding|theme
    IF NOT EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" goto :TRANSFERS
    start /w regedit /s "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" >nul
    for /f "tokens=2* delims=     " %%A IN ('REG QUERY "HKLM\HARDWARE\DESCRIPTION\System\BIOS" /v SystemProductName') DO %INL% set SYSPDT=%%B
    IF NOT DEFINED SYSPDT (goto :TRANSFERS) else IF DEFINED VOID1 IF /I "%SYSPDT%"=="%VOID1%" (goto :TRANSFERS) else IF DEFINED VOID2 IF /I "%SYSPDT%"=="%VOID2%" (goto :TRANSFERS) else IF DEFINED VOID3 IF /I "%SYSPDT%"=="%VOID3%" (goto :TRANSFERS) else IF DEFINED VOID4 IF /I "%SYSPDT%"=="%VOID4%" (goto :TRANSFERS) else IF DEFINED VOID5 IF /I "%SYSPDT%"=="%VOID5%" (goto :TRANSFERS)
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /f /v "Model" /t REG_SZ /d "%SYSPDT%" >nul
    :TRANSFERS
    ::check • screen resolution -> movements|actions
    %windir%\Setup\scripts\MultiMonitorTool.exe /HideInactiveMonitors 1 /stext %windir%\Setup\scripts\monitor.txt
    for /f "tokens=2,3 delims=,: " %%i in ('type %windir%\Setup\scripts\monitor.txt ^| find /i "Right-Bottom"') do %INL% set RESLN=%%iX%%j
    IF EXIST "%windir%\Setup\scripts\MultiMonitorTool.exe" DEL /F /Q "%windir%\Setup\scripts\MultiMonitorTool.exe" >nul
    IF EXIST "%windir%\Setup\scripts\monitor.txt" DEL /F /Q "%windir%\Setup\scripts\monitor.txt" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%RESLN%.jpg" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\%RESLN%.jpg" "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\%RESLN%.jpg" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\%RESLN%.jpg" "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" REN "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "BACKGROUNDDEFAULT.bak" >nul && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\*.jpg" >nul & REN "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.bak" "BACKGROUNDDEFAULT.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" REN "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "WALLPAPER.bak" >nul && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\*.jpg" >nul & REN "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.bak" "WALLPAPER.jpg" >nul
    :TRANSFER1
    ::check • 'Vista' -> movements|actions
    IF /I NOT "%WINVER%"=="VISTA" goto :TRANSFER2
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\backgrounds" cd /d %windir%\Setup\scripts\OEM's\%MAN%\ && RD /S /Q "backgrounds" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" REN %windir%\Web\Wallpaper\img24.jpg img24.bak && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "%windir%\Web\Wallpaper\img24.jpg" >nul
    :TRANSFER2
    ::check • 'Win8.x and Win 10' -> movements|actions
    IF /I "%WINVER%"=="VISTA" GOTO :TRANSFER3
    IF /I "%WINVER%"=="7" GOTO :TRANSFER3
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" MD "%systemdrive%\$%MAN%$\Account" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" "%systemdrive%\$%MAN%$\Account\user.bmp" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user.bmp" "user.bmp.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.bmp" >nul && COPY /Y "%ProgramData%\Microsoft\User Account Pictures\user.bmp.bak" "%systemdrive%\$%MAN%$\Account\original.bmp" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user.png" "user.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.png" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user-40.png" "user-40.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user-40.png" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user-200.png" "user-200.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user-200.png" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\OOBE.xml" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\OOBE.xml" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" TAKEOWN /F "%windir%\Resources\Themes\*.theme" >nul & ICACLS "%windir%\Resources\Themes\*.theme" /reset /T /Q >nul & ICACLS "%windir%\Resources\Themes\*.theme" /grant:r "%windir%\Resources\Themes\*.theme:(OI)(CI)F" 2>nul & REN "%windir%\Resources\Themes\aero.theme"  theme3.theme >nul & MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" "%windir%\Resources\Themes\aero.theme" >nul
    IF EXIST "%windir%\Web\Screen\img100.jpg" TAKEOWN /F "%windir%\Web\Screen\*.jpg" >nul & ICACLS "%windir%\Web\Screen\*.jpg" /reset /T /Q >nul & IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" MD "%systemdrive%\$%MAN%$\LockScreen" >nul && MOVE /Y "%windir%\Web\Screen\img100.jpg" "%systemdrive%\$%MAN%$\LockScreen\original.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%systemdrive%\$%MAN%$\LockScreen\LockScreen.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%windir%\Web\Screen\img100.jpg" >nul
    IF EXIST "%windir%\Web\Screen\img100.png" TAKEOWN /F "%windir%\Web\Screen\*.png" >nul & ICACLS "%windir%\Web\Screen\*.png" /reset /T /Q >nul & IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" MD "%systemdrive%\$%MAN%$\LockScreen" >nul && MOVE /Y "%windir%\Web\Screen\img100.png" "%systemdrive%\$%MAN%$\LockScreen\original.png" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%systemdrive%\$%MAN%$\LockScreen\LockScreen.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%windir%\Web\Screen\img100.png" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" MD "%systemdrive%\$%MAN%$\Desktop" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "%systemdrive%\$%MAN%$\Desktop\Desktop.jpg" >nul
    IF EXIST "%systemdrive%\$%MAN%$\" MOVE /Y "%systemdrive%\$%MAN%$" "%windir%\$%MAN%$" >nul
    ::Enables f8 key for Win 8.x and Win 10 in desktops and laptops |  To disable this feature for tablets put :: in front of the line below
    bcdedit /set {default} bootmenupolicy legacy >nul
    :TRANSFER3
    ::check • 'Windows OS' -> movements|actions
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.bmp" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" "%windir%\Resources\Themes\$OEM$.theme" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.*" MD "%windir%\system32\oobe\info" 2>nul & for /f "delims==" %%F IN ('dir "%windir%\Setup\scripts\OEM's\%MAN%\*.*" /s /b') DO MOVE /Y "%%F" "%windir%\system32\oobe\info\" 2>nul
    cd /d %windir%\Setup\scripts\
    IF EXIST "%windir%\Setup\scripts\OEM's\" DEL /S /F /Q "%windir%\Setup\scripts\OEM's\*.*" >nul && RD /S /Q "%windir%\Setup\scripts\OEM's" >nul
    IF /I "%WINVER%"=="VISTA" GOTO :CLOSE
    IF EXIST "%windir%\Setup\scripts\Certificates\" DEL /S /F /Q "%windir%\Setup\scripts\Certificates\*.*" >nul && RD /S /Q "%windir%\Setup\scripts\Certificates" >nul
    IF EXIST "%windir%\Setup\scripts\oemscan.ini" DEL /F /Q "%windir%\Setup\scripts\oemscan.ini" >nul
    ::===============================================================================================================
    ::LOADER INSTALL
    :Choice2
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Install Windows Loader ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :LoaderInstall
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice3
    :LoaderInstall
    cls
    echo --------------------------------------------------------------------------------
    echo WINDOWS LOADER by Daz
    echo --------------------------------------------------------------------------------
    echo:
    %~dp0"Windows Loader.exe" /silent
    ::===============================================================================================================
    ::NET INSTALL
    :Choice3
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Install .Net Framework ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :NetInstall
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice4
    :NetInstall
    cls
    echo --------------------------------------------------------------------------------
    echo .NET INSTALL
    echo --------------------------------------------------------------------------------
    echo:
    "%~dp0net4install.exe" /silent
    ::===============================================================================================================
    :Choice4
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Reboot (mandatory for Loader) ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :Reboot
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Exit
    ::===============================================================================================================
    :Reboot
    ::finished -> remove 'scripts' dir ('RunOnce' Reg entry) -> self delete 'OOBE.cmd'
    (echo @echo off & echo. & echo IF EXIST "%windir%\Setup\scripts\" RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >"%windir%\Cleanup.cmd"
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v !Clean /t REG_SZ /d "%windir%\Cleanup.cmd" /f >nul
    Timeout /T 8 >nul
    DEL /F /Q %0% >nul
    ENDLOCAL
    shutdown.exe /r /t 0
    ::===============================================================================================================
    :Exit
    ::finished -> remove 'scripts' dir ('RunOnce' Reg entry) -> self delete 'OOBE.cmd'
    (echo @echo off & echo. & echo IF EXIST "%windir%\Setup\scripts\" RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >"%windir%\Cleanup.cmd"
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v !Clean /t REG_SZ /d "%windir%\Cleanup.cmd" /f >nul
    Timeout /T 8 >nul
    DEL /F /Q %0% >nul
    ENDLOCAL
    exit
    
    As you can see the original script from yours is the right one to use. Also I mean the $OEM$.theme in TRANSFER3 part ...

    Moreover, there are no attempts of activation from your script for it is merged in boottask.cmd file. Why? Don't ask me because I don't know. lol
     
  4. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    #64 The_Guardian, Nov 23, 2014
    Last edited: Nov 23, 2014
    I'm confused....testing the multi oem project oobe.cmd in VMware with win 7 now with the $%MAN%$.theme....stand by.

    The theme should say $VMware$ under theme choices....give me a bit.

    Update: I got two themes now...$OEM$ which is blue background and a VMWARE theme. lmao! Win 7 requires theme to be named $OEM$.theme for it to be applied during bootup. Testing again back to the original way to make sure then will upload "again". lol
     
  5. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    Nothing wrong with this part. ;) Updated Multi OEM Project Nov 23, 2014 again....uploading now with corrections.
     
  6. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    No no bro, lol I'm pointing out in my previous post that those lines are good without the ::
    Got it? You told me to put :: in the script for avoiding activation but merging the original oobe.cmd with my boottask.cmd there's no need to.
     
  7. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    Oh ok....you had me scared there for a minute. lol
     
  8. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    #68 Mr.X, Nov 23, 2014
    Last edited: Nov 23, 2014
    (OP)
    :evil: :shisha: now I'm going green :D see?

    Ed. Now testing with all win7 skus and both architectures...:cool:
    It's going to take a while.
    KMS activation pending with s1ave77 solution :cool:
     
  9. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    Having second thoughts, I believe you're right. There's need for a SKU check to prevent Loader msgbox and a msgbox pop up for a KMS activator instead my dear friend :hug2:
     
  10. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    Later ... my brain is one big complex celtic knot atm :cool2:. But no problem at all :D.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    Of course s1ave77, sure. Lot of assistance you've gave us lately, lots :cool: Take your time and rest. You are very kind.
    Anyway I'm posting in the next message my two working scripts for your guidance.
     
  12. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    #72 Mr.X, Nov 24, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    For Windows 7 (tested on all skus):

    boottask.cmd:
    Code:
    @echo off
    setlocal ENABLEDELAYEDEXPANSION
    pushd "%~dp0"
    cd %~dp0
    ::===============================================================================================================
    ::OEM BRANDING
    :Choice1
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Run OEM Branding ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :OEMBranding
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice2
    :OEMBranding
    cls
    echo --------------------------------------------------------------------------------
    echo OEM BRANDING
    echo --------------------------------------------------------------------------------
    echo:
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: 'OOBE.cmd' -> 'Windows 10' • 'Windows 8.x' • 'Windows 7' • 'Windows Vista' : Nov 18|2014 :
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    SET EDITION=&SET CSNAME=&SET CSVENDOR=&SET SYSMODEL=&SET SYSMNF=&SET BASEPRO=&SET BASEMNF=&SET BIOVER=&SET MAN=DEFAULT&SET MAN2=&SET PIDKEY=&SET REALMAN=&SET WINVER=&SET INFO=INFO&SET LAST=LAST&SET INL=IF NOT ERRORLEVEL 1&SET RESLN=&SET SLIC=SLIC
    SET OEMS=%windir%\Setup\scripts\oemscan.ini&SET RQR1=REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"&SET RQR2=REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionId"
    :OS
    ::check • set 'Windows OS' -> '10|8.x|7|Vista' ('findstr' -> word start|end '\<','\>')
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<PREVIEW\>" >nul&&%INL% SET WINVER=10&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<10\>" >nul&&%INL% SET WINVER=10&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<8\>" >nul&&%INL% SET WINVER=8&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<7\>" >nul&&%INL% SET WINVER=7&goto :EDITION
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<VISTA\>" >nul&&%INL% SET WINVER=VISTA&goto :EDITION
    :EDITION
    ::check • set 'Windows Edition' -> 'ULTIMATE|BUSINESS|PROFESSIONAL|HOMEPREMIUM|HOMEBASIC|STARTER' ('findstr' -> word start|end '\<','\>')
    %RQR2% | findstr /I "\<ULTIMATE\>" >nul&&%INL% SET EDITION=ULTIMATE&goto :BIOS
    %RQR2% | findstr /I "\<BUSINESS\>" >nul&&%INL% SET EDITION=BUSINESS&goto :BIOS
    %RQR2% | findstr /I "\<PROFESSIONAL\>" >nul&&%INL% SET EDITION=PROFESSIONAL&goto :BIOS
    %RQR2% | findstr /I "\<HOMEPREMIUM\>" >nul&&%INL% SET EDITION=HOMEPREMIUM&goto :BIOS
    %RQR2% | findstr /I "\<HOMEBASIC\>" >nul&&%INL% SET EDITION=HOMEBASIC&goto :BIOS
    %RQR2% | findstr /I "\<STARTER\>" >nul&&%INL% SET EDITION=STARTER&goto :BIOS
    :BIOS
    ::check • set 'Manufacturer Name' from 'CSPRODUCT|COMPUTERSYSTEM|BASEBOARD|BIOS' ID's -> filter 'results' via oemscan.ini
    for /f "tokens=2 delims==" %%A in ('"WMIC CSPRODUCT GET NAME /format:list"') do %INL% (set CSNAME=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC CSPRODUCT GET VENDOR /format:list"') do %INL% (set CSVENDOR=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC COMPUTERSYSTEM GET MODEL /format:list"') do %INL% (set SYSMODEL=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC COMPUTERSYSTEM GET MANUFACTURER /format:list"') do %INL% (set SYSMNF=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC BASEBOARD GET PRODUCT /format:list"') do %INL% (set BASEPRO=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC BASEBOARD GET MANUFACTURER /format:list"') do %INL% (set BASEMNF=%%A)
    for /f "tokens=2 delims== " %%A in ('"WMIC BIOS GET VERSION /format:list"') do %INL% (set BIOVER=%%A)
    :FILTER
    ::check • filter 'results' ('findstr' specific list order -> word start|end '\<','\>') -> by-pass 'void|conflict' entries
    SET VOID1=To Be Filled By O.E.M.&SET VOID2=System Product Name&SET VOID3=System manufacturer&SET VOID4=Base Board Product Name&SET VOID5=Intel Corporation
    :CHECK1
    IF DEFINED VOID1 IF /I "%CSNAME%"=="%VOID1%" (goto :CHECK2) else IF DEFINED VOID2 IF /I "%CSNAME%"=="%VOID2%" (goto :CHECK2) else IF DEFINED VOID3 IF /I "%CSNAME%"=="%VOID3%" (goto :CHECK2) else IF DEFINED VOID4 IF /I "%CSNAME%"=="%VOID4%" (goto :CHECK2) else IF DEFINED VOID5 IF /I "%CSNAME%"=="%VOID5%" (goto :CHECK2)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%CSNAME%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK2
    IF DEFINED VOID1 IF /I "%SYSMODEL%"=="%VOID1%" (goto :CHECK3) else IF DEFINED VOID2 IF /I "%SYSMODEL%"=="%VOID2%" (goto :CHECK3) else IF DEFINED VOID3 IF /I "%SYSMODEL%"=="%VOID3%" (goto :CHECK3) else IF DEFINED VOID4 IF /I "%SYSMODEL%"=="%VOID4%" (goto :CHECK3) else IF DEFINED VOID5 IF /I "%SYSMODEL%"=="%VOID5%" (goto :CHECK3)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%SYSMODEL%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK3
    IF DEFINED VOID1 IF /I "%BASEPRO%"=="%VOID1%" (goto :CHECK4) else IF DEFINED VOID2 IF /I "%BASEPRO%"=="%VOID2%" (goto :CHECK4) else IF DEFINED VOID3 IF /I "%BASEPRO%"=="%VOID3%" (goto :CHECK4) else IF DEFINED VOID4 IF /I "%BASEPRO%"=="%VOID4%" (goto :CHECK4) else IF DEFINED VOID5 IF /I "%BASEPRO%"=="%VOID5%" (goto :CHECK4)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%BASEPRO%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK4
    IF DEFINED VOID1 IF /I "%CSVENDOR%"=="%VOID1%" (goto :CHECK5) else IF DEFINED VOID2 IF /I "%CSVENDOR%"=="%VOID2%" (goto :CHECK5) else IF DEFINED VOID3 IF /I "%CSVENDOR%"=="%VOID3%" (goto :CHECK5) else IF DEFINED VOID4 IF /I "%CSVENDOR%"=="%VOID4%" (goto :CHECK5) else IF DEFINED VOID5 IF /I "%CSVENDOR%"=="%VOID5%" (goto :CHECK5)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%CSVENDOR%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK5
    IF DEFINED VOID1 IF /I "%SYSMNF%"=="%VOID1%" (goto :CHECK6) else IF DEFINED VOID2 IF /I "%SYSMNF%"=="%VOID2%" (goto :CHECK6) else IF DEFINED VOID3 IF /I "%SYSMNF%"=="%VOID3%" (goto :CHECK6) else IF DEFINED VOID4 IF /I "%SYSMNF%"=="%VOID4%" (goto :CHECK6) else IF DEFINED VOID5 IF /I "%SYSMNF%"=="%VOID5%" (goto :CHECK6)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%SYSMNF%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK6
    IF DEFINED VOID1 IF /I "%BIOVER%"=="%VOID1%" (goto :CHECKOUT) else IF DEFINED VOID2 IF /I "%BIOVER%"=="%VOID2%" (goto :CHECKOUT) else IF DEFINED VOID3 IF /I "%BIOVER%"=="%VOID3%" (goto :CHECKOUT) else IF DEFINED VOID4 IF /I "%BIOVER%"=="%VOID4%" (goto :CHECKOUT) else IF DEFINED VOID5 IF /I "%BIOVER%"=="%VOID5%" (goto :CHECKOUT)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%SLIC%%\>" ^| findstr /I "\<%%BIOVER%%\>"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECKOUT
    REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VMware\>" >nul&&%INL% goto :SETKEY
    REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VirtualBox\>" >nul&&%INL% goto :SETKEY
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%BASEMNF%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :SETKEY
    ::set 'genuine' activation -> use bios version id (if detected), bios may be modded|shared (ie.'Dell PC' - bios mod 'ACRSYS-Acer'; etc) -> ('findstr' -> word start|end '\<','\>')
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%SLIC%%\>" ^| findstr /I "\<%%BIOVER%%\>"') do (set MAN2=%%c)
    IF /I "%MAN%"=="DEFAULT" REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VMware\>" >nul&&%INL% SET MAN=VMWARE
    IF /I "%MAN%"=="DEFAULT" REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VirtualBox\>" >nul&&%INL% SET MAN=VBOX
    IF /I "%MAN2%"=="GATEWAY" IF /I "%MAN%"=="EMACHINES" SET MAN2=EMACHINES&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="EMACHINES" SET MAN2=EMACHINES&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="GATEWAY" SET MAN2=GATEWAY&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="PBELL" SET MAN2=PBELL&goto :SERIAL
    IF /I "%MAN2%"=="HP" IF /I "%MAN%"=="COMPAQ" SET MAN2=COMPAQ&goto :SERIAL
    IF /I "%MAN2%"=="LENOVO" IF /I "%MAN%"=="IBM" SET MAN2=IBM&goto :SERIAL
    IF NOT DEFINED MAN2 SET MAN2=%MAN%&goto :SERIAL
    :SERIAL
    ::scan 'oemscan.ini' once with the provided 'Manufacturer|OS|Edition' -> if not matched, set the manufacturer (serial) to 'DEFAULTOEM' (Acer) & try again -> ('findstr' -> word start|end '\<','\>')
    IF /I "%WINVER%"=="10" GOTO :WIN810
    IF /I "%WINVER%"=="8" GOTO :WIN810
    IF NOT DEFINED WINVER GOTO :BRANDING
    IF NOT DEFINED EDITION GOTO :BRANDING
    IF EXIST %OEMS% for /f "tokens=1,2,3,4 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%EDITION%%\>" ^| findstr /I "\<%%MAN2%%\>"') do (echo %%a | findstr /I "\<%WINVER%\>" >nul &&%INL% set PIDKEY=%%d)
    IF NOT DEFINED PIDKEY set REALMAN=%MAN2%&set MAN2=DEFAULTOEM&goto :SERIAL
    IF /I "%MAN2%"=="DEFAULTOEM" set MAN2=%REALMAN%
    :ACTIVATION
    ::create 'activate.cmd' -> 'CALL' -> from 'OOBE.cmd' for 'WIN7' or 'SetupComplete.cmd' for 'VISTA'
    (echo @echo off & echo. & echo :ACTIVATE & echo ::apply serial:: & echo cscript //nologo %windir%\system32\slmgr.vbs -ipk %PIDKEY% ^>^nul & echo ::apply certificate ^& 2nd, 3rd, 4th, etc, if available::
    echo IF EXIST "%windir%\Setup\scripts\Certificates\%MAN2%.xrm-ms" for /f "tokens=*" %%%%A in ^('DIR /B "%windir%\Setup\scripts\Certificates\%MAN2%*.xrm-ms"'^) DO ^(
    echo cscript //nologo %windir%\system32\slmgr.vbs -ilc "%windir%\Setup\scripts\Certificates\%%%%A" ^>^nul^) & echo IF EXIST "%windir%\Setup\scripts\oemscan.ini" DEL /F /Q "%windir%\Setup\scripts\oemscan.ini" ^>^nul
    echo IF EXIST "%windir%\Setup\scripts\Certificates\" DEL /S /F /Q "%windir%\Setup\scripts\Certificates\*.*" ^>^nul ^&^& RD /S /Q "%windir%\Setup\scripts\Certificates" ^>^nul) >"%windir%\Setup\scripts\activate.cmd"
    IF /I NOT "%WINVER%"=="VISTA" GOTO :OOBE
    ::'VISTA only' check 'SetupComplete.cmd' exists -> 'NO' rename|edit 'activate.cmd' -> 'YES' -> edit existing 'SetupComplete.cmd'
    IF NOT EXIST %windir%\Setup\scripts\SetupComplete.cmd (move /Y %windir%\Setup\scripts\activate.cmd %windir%\Setup\scripts\no4.txt >nul
    (echo RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >%windir%\Setup\scripts\no3.txt 
    copy /b %windir%\Setup\scripts\no4.txt+%windir%\Setup\scripts\no3.txt %windir%\Setup\scripts\SetupComplete.cmd >nul & del /F /Q %windir%\Setup\scripts\no4.txt >nul %windir%\Setup\scripts\no3.txt >nul
    ) ELSE (Type %windir%\Setup\scripts\SetupComplete.cmd | findstr /I /V /C:"@echo off" >%windir%\Setup\scripts\no2.txt && del /F /Q %windir%\Setup\scripts\SetupComplete.cmd >nul
    (echo @echo off & echo. & echo IF EXIST %windir%\Setup\scripts\activate.cmd CALL %windir%\Setup\scripts\activate.cmd ^>^nul ^&^& DEL /F /Q %windir%\Setup\scripts\activate.cmd ^>^nul) >%windir%\Setup\scripts\no1.txt 
    copy /b %windir%\Setup\scripts\no1.txt+%windir%\Setup\scripts\no2.txt %windir%\Setup\scripts\SetupComplete.cmd >nul & del /F /Q %windir%\Setup\scripts\no1.txt >nul %windir%\Setup\scripts\no2.txt >nul)
    GOTO :BRANDING
    :WIN810
    %windir%\Setup\scripts\Rw.exe /Min /NoLogo /command="ACPI Dump MSDM";"RwExit" /logfile=%windir%\Setup\scripts\msdm.log
    for /f "Skip=1 tokens=2 delims=    " %%A in ('find "-" %windir%\Setup\scripts\msdm.log') do %INL% set DM=%%A
    cscript //B %windir%\system32\slmgr.vbs /ipk %DM% >nul
    cscript //B %windir%\system32\slmgr.vbs /ato >nul
    IF EXIST "%windir%\Setup\scripts\msdm.log" DEL /F /Q "%windir%\Setup\scripts\msdm.log" >nul
    GOTO :BRANDING
    :OOBE
    ::check • apply created 'activate.cmd' -> from this 'OOBE.cmd'
    IF EXIST %windir%\Setup\scripts\activate.cmd cd /d %windir%\Setup\scripts\ && CALL "activate.cmd" >nul
    IF EXIST %windir%\Setup\scripts\activate.cmd DEL /F /Q %windir%\Setup\scripts\activate.cmd >nul
    :BRANDING
    ::check • set 'MAN=?' -> if exist 'Force_Theme_[readme].txt' || edit brand '.reg file' -> if installing 'Starter' Edition
    IF EXIST "%windir%\Setup\scripts\Rw.exe" DEL /F /Q "%windir%\Setup\scripts\Rw.exe" >nul
    cd /d %windir%\Setup\scripts\OEM's\ && for /r %%G in (.) DO IF EXIST %%G\Force_Theme_[readme].txt DEL /F /Q %%G\Force_Theme_[readme].txt >nul &&set MAN=%%~nG
    IF EXIST "%windir%\Setup\scripts\Force_Theme_[readme].txt" DEL /F /Q "%windir%\Setup\scripts\Force_Theme_[readme].txt" >nul
    IF /I NOT "%EDITION%"=="STARTER" GOTO :CONTINUE
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" (cd /d %windir%\Setup\scripts\OEM's\%MAN%\ >nul & Type %MAN%.reg | findstr /I /V "InstallTheme" >STARTER.reg && MOVE /Y "STARTER.reg" "%MAN%.reg" >nul)
    :CONTINUE
    ::finalize branding|theme
    IF NOT EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" goto :TRANSFERS
    start /w regedit /s "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" >nul
    for /f "tokens=2* delims=     " %%A IN ('REG QUERY "HKLM\HARDWARE\DESCRIPTION\System\BIOS" /v SystemProductName') DO %INL% set SYSPDT=%%B
    IF NOT DEFINED SYSPDT (goto :TRANSFERS) else IF DEFINED VOID1 IF /I "%SYSPDT%"=="%VOID1%" (goto :TRANSFERS) else IF DEFINED VOID2 IF /I "%SYSPDT%"=="%VOID2%" (goto :TRANSFERS) else IF DEFINED VOID3 IF /I "%SYSPDT%"=="%VOID3%" (goto :TRANSFERS) else IF DEFINED VOID4 IF /I "%SYSPDT%"=="%VOID4%" (goto :TRANSFERS) else IF DEFINED VOID5 IF /I "%SYSPDT%"=="%VOID5%" (goto :TRANSFERS)
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /f /v "Model" /t REG_SZ /d "%SYSPDT%" >nul
    :TRANSFERS
    ::check • screen resolution -> movements|actions
    %windir%\Setup\scripts\MultiMonitorTool.exe /HideInactiveMonitors 1 /stext %windir%\Setup\scripts\monitor.txt
    for /f "tokens=2,3 delims=,: " %%i in ('type %windir%\Setup\scripts\monitor.txt ^| find /i "Right-Bottom"') do %INL% set RESLN=%%iX%%j
    IF EXIST "%windir%\Setup\scripts\MultiMonitorTool.exe" DEL /F /Q "%windir%\Setup\scripts\MultiMonitorTool.exe" >nul
    IF EXIST "%windir%\Setup\scripts\monitor.txt" DEL /F /Q "%windir%\Setup\scripts\monitor.txt" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%RESLN%.jpg" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\%RESLN%.jpg" "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\%RESLN%.jpg" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\%RESLN%.jpg" "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" REN "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "BACKGROUNDDEFAULT.bak" >nul && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\*.jpg" >nul & REN "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.bak" "BACKGROUNDDEFAULT.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" REN "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "WALLPAPER.bak" >nul && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\*.jpg" >nul & REN "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.bak" "WALLPAPER.jpg" >nul
    :TRANSFER1
    ::check • 'Vista' -> movements|actions
    IF /I NOT "%WINVER%"=="VISTA" goto :TRANSFER2
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\backgrounds" cd /d %windir%\Setup\scripts\OEM's\%MAN%\ && RD /S /Q "backgrounds" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" REN %windir%\Web\Wallpaper\img24.jpg img24.bak && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "%windir%\Web\Wallpaper\img24.jpg" >nul
    :TRANSFER2
    ::check • 'Win8.x and Win 10' -> movements|actions
    IF /I "%WINVER%"=="VISTA" GOTO :TRANSFER3
    IF /I "%WINVER%"=="7" GOTO :TRANSFER3
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" MD "%systemdrive%\$%MAN%$\Account" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" "%systemdrive%\$%MAN%$\Account\user.bmp" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user.bmp" "user.bmp.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.bmp" >nul && COPY /Y "%ProgramData%\Microsoft\User Account Pictures\user.bmp.bak" "%systemdrive%\$%MAN%$\Account\original.bmp" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user.png" "user.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.png" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user-40.png" "user-40.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user-40.png" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user-200.png" "user-200.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user-200.png" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\OOBE.xml" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\OOBE.xml" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" TAKEOWN /F "%windir%\Resources\Themes\*.theme" >nul & ICACLS "%windir%\Resources\Themes\*.theme" /reset /T /Q >nul & ICACLS "%windir%\Resources\Themes\*.theme" /grant:r "%windir%\Resources\Themes\*.theme:(OI)(CI)F" 2>nul & REN "%windir%\Resources\Themes\aero.theme"  theme3.theme >nul & MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" "%windir%\Resources\Themes\aero.theme" >nul
    IF EXIST "%windir%\Web\Screen\img100.jpg" TAKEOWN /F "%windir%\Web\Screen\*.jpg" >nul & ICACLS "%windir%\Web\Screen\*.jpg" /reset /T /Q >nul & IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" MD "%systemdrive%\$%MAN%$\LockScreen" >nul && MOVE /Y "%windir%\Web\Screen\img100.jpg" "%systemdrive%\$%MAN%$\LockScreen\original.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%systemdrive%\$%MAN%$\LockScreen\LockScreen.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%windir%\Web\Screen\img100.jpg" >nul
    IF EXIST "%windir%\Web\Screen\img100.png" TAKEOWN /F "%windir%\Web\Screen\*.png" >nul & ICACLS "%windir%\Web\Screen\*.png" /reset /T /Q >nul & IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" MD "%systemdrive%\$%MAN%$\LockScreen" >nul && MOVE /Y "%windir%\Web\Screen\img100.png" "%systemdrive%\$%MAN%$\LockScreen\original.png" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%systemdrive%\$%MAN%$\LockScreen\LockScreen.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%windir%\Web\Screen\img100.png" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" MD "%systemdrive%\$%MAN%$\Desktop" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "%systemdrive%\$%MAN%$\Desktop\Desktop.jpg" >nul
    IF EXIST "%systemdrive%\$%MAN%$\" MOVE /Y "%systemdrive%\$%MAN%$" "%windir%\$%MAN%$" >nul
    ::Enables f8 key for Win 8.x and Win 10 in desktops and laptops |  To disable this feature for tablets put :: in front of the line below
    bcdedit /set {default} bootmenupolicy legacy >nul
    :TRANSFER3
    ::check • 'Windows OS' -> movements|actions
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.bmp" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" "%windir%\Resources\Themes\$OEM$.theme" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.*" MD "%windir%\system32\oobe\info" 2>nul & for /f "delims==" %%F IN ('dir "%windir%\Setup\scripts\OEM's\%MAN%\*.*" /s /b') DO MOVE /Y "%%F" "%windir%\system32\oobe\info\" 2>nul
    cd /d %windir%\Setup\scripts\
    IF EXIST "%windir%\Setup\scripts\OEM's\" DEL /S /F /Q "%windir%\Setup\scripts\OEM's\*.*" >nul && RD /S /Q "%windir%\Setup\scripts\OEM's" >nul
    IF /I "%WINVER%"=="VISTA" GOTO :CLOSE
    IF EXIST "%windir%\Setup\scripts\Certificates\" DEL /S /F /Q "%windir%\Setup\scripts\Certificates\*.*" >nul && RD /S /Q "%windir%\Setup\scripts\Certificates" >nul
    IF EXIST "%windir%\Setup\scripts\oemscan.ini" DEL /F /Q "%windir%\Setup\scripts\oemscan.ini" >nul
    ::===============================================================================================================
    ::LOADER INSTALL
    :Choice2
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Install Windows Loader ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :LoaderInstall
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice3
    :LoaderInstall
    cls
    echo --------------------------------------------------------------------------------
    echo WINDOWS LOADER by Daz
    echo --------------------------------------------------------------------------------
    echo:
    %~dp0"Windows Loader.exe" /silent /swap
    ::===============================================================================================================
    ::NET INSTALL
    :Choice3
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Install .Net Framework ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :NetInstall
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice4
    :NetInstall
    cls
    echo --------------------------------------------------------------------------------
    echo .NET INSTALL
    echo --------------------------------------------------------------------------------
    echo:
    "%~dp0net4install.exe" /silent
    ::===============================================================================================================
    :Choice4
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments >%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>%file% 
    %file% "BootTask" "Reboot (mandatory for Loader) ?" 4 
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :Reboot
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Exit
    ::===============================================================================================================
    :Reboot
    ::finished -> remove 'scripts' dir ('RunOnce' Reg entry) -> self delete 'OOBE.cmd'
    (echo @echo off & echo. & echo IF EXIST "%windir%\Setup\scripts\" RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >"%windir%\Cleanup.cmd"
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v !Clean /t REG_SZ /d "%windir%\Cleanup.cmd" /f >nul
    Timeout /T 8 >nul
    DEL /F /Q %0% >nul
    ENDLOCAL
    shutdown.exe /r /t 0
    ::===============================================================================================================
    :Exit
    ::finished -> remove 'scripts' dir ('RunOnce' Reg entry) -> self delete 'OOBE.cmd'
    (echo @echo off & echo. & echo IF EXIST "%windir%\Setup\scripts\" RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >"%windir%\Cleanup.cmd"
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v !Clean /t REG_SZ /d "%windir%\Cleanup.cmd" /f >nul
    Timeout /T 8 >nul
    DEL /F /Q %0% >nul
    ENDLOCAL
    exit
    

    setupcomplete.cmd:
    Code:
    @echo off
    setlocal ENABLEDELAYEDEXPANSION
    pushd "%~dp0"
    cd %~dp0
    ::===============================================================================================================
    Reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" /v Title /t REG_SZ /d BootTask /f
    Reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" /v Flags /t REG_DWORD /d 2 /f
    Reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0001"  /v MyScript /t REG_SZ /d "C:\Windows\Setup\Scripts\boottask.cmd"  /f
    
    
    :Exit
    ENDLOCAL
    exit
    

    Guess we need the following options scheme for Windows Loader and KMS activator:

    x86
    - S, HB, HP, Pro, Ult >>>> Loader msgbox | KMS act msgbox
    - Enterprise >>>>>>>>> Loader msgbox | KMS act msgbox

    x64
    BIOS/UEFI-MBR scheme:
    - HB, HP, Pro, Ult >>>>>> Loader msgbox | KMS act msgbox
    - Enterprise >>>>>>>>> Loader msgbox | KMS act msgbox

    UEFI-GPT scheme:
    - HB, HP, Ult>>>>>>>>> Warning msgbox*
    - Pro, Ent >>>>>>>>>> Loader msgbox | KMS act msgbox

    *A warning msgbox when Home Basic, Home Premium and Ultimate are detected for they are not capable of activation with the supplied activators.

    Guess the GPT scheme poses a new challenge combined with MBR scheme.
     
  13. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    #73 s1ave77, Nov 27, 2014
    Last edited by a moderator: Apr 20, 2017
    OK, let's get this done :D.

    No difference between x86 and x64 as script will check for Ent and Pro and handle the rest by Loader.

    Found a nice way to check the current BootDevice for partition layout with powershell :good3::

    Code:
    ::===============================================================================================================
    ::CHECK PARTITION LAYOUT
    set "listdisk=%temp%\listdisk.ps1"
    echo gwmi -query "Select * from Win32_DiskPartition WHERE Index = 0 and BootPartition = True" ^| Select-Object @{Name="GPT";Expression={$_.Type.StartsWith^("GPT"^)}} ^| fl>%listdisk%
    for /f "tokens=2 delims=: " %%a in ('powershell -executionpolicy bypass -file %listdisk%') do set "layout=%%a"
    if exist "%listdisk%" del /s /q "%listdisk%" >nul
    
    It will set to 'True' if layout is GPT or 'False' if layout is MBR.

    So:
    • Script will offer Loader when detects 'False' and is neither 'Pro' nor 'Ent'. If it's Pro it will offer choice between Loader and KMS.
    • Script will offer KMS when detects 'True' and is either 'Pro' or 'Ent'.
    • Script will show Warning Message when detects 'True' and is neither 'Pro' nor 'Ent' and proceed with .NET install choice.


    KMS Setup:
    • Copy KMS Server Service by CODYQX4 matching system architecture to created folder in %windir%
    • Create needed reg entries and firewall rules
    • Register the Service in demand mode to not have it running all the time
    • Create Task Scheduler Tasks for StartUp/LogOn/24hrs
    • Create Reactivation CMD in folder to start service, activate and stop service afterwards
    • Activate the sytem on the fly

    Script assumes CODYs file in same folder (for convenience i attached both; are those offered in Emulator Source thread, so no worry) KMSEmulator - KMS Client and Server Emulation [Source]

    Code:
    File: KMS Server Service x86.exe
    Size: 207 kB
    MD5: 1FE4528C1D6C9A303094C1A48EFCB193
    SHA-1: F0D8AC5473E155CBD0D0DE19134387743A387EA5
    SHA-256: 0DD1F361D0D7B521B214CE3E17086863F06B7073D7763128749D76F765066E93
    File: KMS Server Service x64.exe 
    Size: 243 KB
    MD5: 2399D35AE123607625ED278475B3605C
    SHA-1: B5D778D9BFE77755093007C2EE3A266F8B4B1DFC
    SHA-256: 1E33EC85E4F877F9F4AF14342ED1A15AFD277D2F7671C860844CEAC5FA5E5AAB
    

    View attachment 32358

    Script:

    Code:
    @echo off
    setlocal ENABLEDELAYEDEXPANSION
    pushd "%~dp0"
    cd %~dp0
    ::===============================================================================================================
    ::===============================================================================================================
    ::SET SYSTEM VARIABLES
    for /f "tokens=2* delims= " %%a in ('reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v "PROCESSOR_ARCHITECTURE"') do (
    if "%%b" == "AMD64" set vera=x64
    if "%%b" == "x86" set vera=x86
    )
    FOR /F "tokens=3* delims= " %%I IN ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" ^| findstr EditionID') DO (SET edition=%%I)
    ::===============================================================================================================
    ::CHECK PARTITION LAYOUT
    set "listdisk=%temp%\listdisk.ps1"
    echo gwmi -query "Select * from Win32_DiskPartition WHERE Index = 0 and BootPartition = True" ^| Select-Object @{Name="GPT";Expression={$_.Type.StartsWith^("GPT"^)}} ^| fl>%listdisk%
    for /f "tokens=2 delims=: " %%a in ('powershell -executionpolicy bypass -file %listdisk%') do set "layout=%%a"
    if exist "%listdisk%" del /s /q "%listdisk%" >nul
    ::===============================================================================================================
    ::===============================================================================================================
    ::OEM BRANDING
    :Choice1
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments>%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0))>>%file% 
    %file% "BootTask" "Run OEM Branding ?" 4
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :OEMBranding
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice2
    :OEMBranding
    cls
    echo --------------------------------------------------------------------------------
    echo OEM BRANDING
    echo --------------------------------------------------------------------------------
    echo:
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: 'OOBE.cmd' -> 'Windows 10' • 'Windows 8.x' • 'Windows 7' • 'Windows Vista' : Nov 18|2014 :
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    SET EDITION=&SET CSNAME=&SET CSVENDOR=&SET SYSMODEL=&SET SYSMNF=&SET BASEPRO=&SET BASEMNF=&SET BIOVER=&SET MAN=DEFAULT&SET MAN2=&SET PIDKEY=&SET REALMAN=&SET WINVER=&SET INFO=INFO&SET LAST=LAST&SET INL=IF NOT ERRORLEVEL 1&SET RESLN=&SET SLIC=SLIC
    SET OEMS=%windir%\Setup\scripts\oemscan.ini&SET RQR1=REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"&SET RQR2=REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionId"
    :OS
    ::check • set 'Windows OS' -> '10|8.x|7|Vista' ('findstr' -> word start|end '\<','\>')
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<PREVIEW\>" >nul&&%INL% SET WINVER=10&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<10\>" >nul&&%INL% SET WINVER=10&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<8\>" >nul&&%INL% SET WINVER=8&goto :BIOS
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<7\>" >nul&&%INL% SET WINVER=7&goto :EDITION
    %RQR1% | findstr /I "\<WINDOWS\>" | findstr /I "\<VISTA\>" >nul&&%INL% SET WINVER=VISTA&goto :EDITION
    :EDITION
    ::check • set 'Windows Edition' -> 'ULTIMATE|BUSINESS|PROFESSIONAL|HOMEPREMIUM|HOMEBASIC|STARTER' ('findstr' -> word start|end '\<','\>')
    %RQR2% | findstr /I "\<ULTIMATE\>" >nul&&%INL% SET EDITION=ULTIMATE&goto :BIOS
    %RQR2% | findstr /I "\<BUSINESS\>" >nul&&%INL% SET EDITION=BUSINESS&goto :BIOS
    %RQR2% | findstr /I "\<PROFESSIONAL\>" >nul&&%INL% SET EDITION=PROFESSIONAL&goto :BIOS
    %RQR2% | findstr /I "\<HOMEPREMIUM\>" >nul&&%INL% SET EDITION=HOMEPREMIUM&goto :BIOS
    %RQR2% | findstr /I "\<HOMEBASIC\>" >nul&&%INL% SET EDITION=HOMEBASIC&goto :BIOS
    %RQR2% | findstr /I "\<STARTER\>" >nul&&%INL% SET EDITION=STARTER&goto :BIOS
    :BIOS
    ::check • set 'Manufacturer Name' from 'CSPRODUCT|COMPUTERSYSTEM|BASEBOARD|BIOS' ID's -> filter 'results' via oemscan.ini
    for /f "tokens=2 delims==" %%A in ('"WMIC CSPRODUCT GET NAME /format:list"') do %INL% (set CSNAME=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC CSPRODUCT GET VENDOR /format:list"') do %INL% (set CSVENDOR=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC COMPUTERSYSTEM GET MODEL /format:list"') do %INL% (set SYSMODEL=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC COMPUTERSYSTEM GET MANUFACTURER /format:list"') do %INL% (set SYSMNF=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC BASEBOARD GET PRODUCT /format:list"') do %INL% (set BASEPRO=%%A)
    for /f "tokens=2 delims==" %%A in ('"WMIC BASEBOARD GET MANUFACTURER /format:list"') do %INL% (set BASEMNF=%%A)
    for /f "tokens=2 delims== " %%A in ('"WMIC BIOS GET VERSION /format:list"') do %INL% (set BIOVER=%%A)
    :FILTER
    ::check • filter 'results' ('findstr' specific list order -> word start|end '\<','\>') -> by-pass 'void|conflict' entries
    SET VOID1=To Be Filled By O.E.M.&SET VOID2=System Product Name&SET VOID3=System manufacturer&SET VOID4=Base Board Product Name&SET VOID5=Intel Corporation
    :CHECK1
    IF DEFINED VOID1 IF /I "%CSNAME%"=="%VOID1%" (goto :CHECK2) else IF DEFINED VOID2 IF /I "%CSNAME%"=="%VOID2%" (goto :CHECK2) else IF DEFINED VOID3 IF /I "%CSNAME%"=="%VOID3%" (goto :CHECK2) else IF DEFINED VOID4 IF /I "%CSNAME%"=="%VOID4%" (goto :CHECK2) else IF DEFINED VOID5 IF /I "%CSNAME%"=="%VOID5%" (goto :CHECK2)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%CSNAME%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK2
    IF DEFINED VOID1 IF /I "%SYSMODEL%"=="%VOID1%" (goto :CHECK3) else IF DEFINED VOID2 IF /I "%SYSMODEL%"=="%VOID2%" (goto :CHECK3) else IF DEFINED VOID3 IF /I "%SYSMODEL%"=="%VOID3%" (goto :CHECK3) else IF DEFINED VOID4 IF /I "%SYSMODEL%"=="%VOID4%" (goto :CHECK3) else IF DEFINED VOID5 IF /I "%SYSMODEL%"=="%VOID5%" (goto :CHECK3)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%SYSMODEL%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK3
    IF DEFINED VOID1 IF /I "%BASEPRO%"=="%VOID1%" (goto :CHECK4) else IF DEFINED VOID2 IF /I "%BASEPRO%"=="%VOID2%" (goto :CHECK4) else IF DEFINED VOID3 IF /I "%BASEPRO%"=="%VOID3%" (goto :CHECK4) else IF DEFINED VOID4 IF /I "%BASEPRO%"=="%VOID4%" (goto :CHECK4) else IF DEFINED VOID5 IF /I "%BASEPRO%"=="%VOID5%" (goto :CHECK4)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%BASEPRO%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK4
    IF DEFINED VOID1 IF /I "%CSVENDOR%"=="%VOID1%" (goto :CHECK5) else IF DEFINED VOID2 IF /I "%CSVENDOR%"=="%VOID2%" (goto :CHECK5) else IF DEFINED VOID3 IF /I "%CSVENDOR%"=="%VOID3%" (goto :CHECK5) else IF DEFINED VOID4 IF /I "%CSVENDOR%"=="%VOID4%" (goto :CHECK5) else IF DEFINED VOID5 IF /I "%CSVENDOR%"=="%VOID5%" (goto :CHECK5)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%CSVENDOR%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK5
    IF DEFINED VOID1 IF /I "%SYSMNF%"=="%VOID1%" (goto :CHECK6) else IF DEFINED VOID2 IF /I "%SYSMNF%"=="%VOID2%" (goto :CHECK6) else IF DEFINED VOID3 IF /I "%SYSMNF%"=="%VOID3%" (goto :CHECK6) else IF DEFINED VOID4 IF /I "%SYSMNF%"=="%VOID4%" (goto :CHECK6) else IF DEFINED VOID5 IF /I "%SYSMNF%"=="%VOID5%" (goto :CHECK6)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%SYSMNF%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECK6
    IF DEFINED VOID1 IF /I "%BIOVER%"=="%VOID1%" (goto :CHECKOUT) else IF DEFINED VOID2 IF /I "%BIOVER%"=="%VOID2%" (goto :CHECKOUT) else IF DEFINED VOID3 IF /I "%BIOVER%"=="%VOID3%" (goto :CHECKOUT) else IF DEFINED VOID4 IF /I "%BIOVER%"=="%VOID4%" (goto :CHECKOUT) else IF DEFINED VOID5 IF /I "%BIOVER%"=="%VOID5%" (goto :CHECKOUT)
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%SLIC%%\>" ^| findstr /I "\<%%BIOVER%%\>"') do %INL% (set MAN=%%c&goto :SETKEY)
    :CHECKOUT
    REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VMware\>" >nul&&%INL% goto :SETKEY
    REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VirtualBox\>" >nul&&%INL% goto :SETKEY
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%INFO%%\>" ^| findstr /I "\<%%BASEMNF%%"') do %INL% (set MAN=%%c&goto :SETKEY)
    :SETKEY
    ::set 'genuine' activation -> use bios version id (if detected), bios may be modded|shared (ie.'Dell PC' - bios mod 'ACRSYS-Acer'; etc) -> ('findstr' -> word start|end '\<','\>')
    IF EXIST %OEMS% for /f "tokens=1,2,3 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%SLIC%%\>" ^| findstr /I "\<%%BIOVER%%\>"') do (set MAN2=%%c)
    IF /I "%MAN%"=="DEFAULT" REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VMware\>" >nul&&%INL% SET MAN=VMWARE
    IF /I "%MAN%"=="DEFAULT" REG QUERY "HKLM\SYSTEM\ControlSet001\Control\SystemInformation" /v "SystemProductName" | findstr /I "\<VirtualBox\>" >nul&&%INL% SET MAN=VBOX
    IF /I "%MAN2%"=="GATEWAY" IF /I "%MAN%"=="EMACHINES" SET MAN2=EMACHINES&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="EMACHINES" SET MAN2=EMACHINES&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="GATEWAY" SET MAN2=GATEWAY&goto :SERIAL
    IF /I "%MAN2%"=="ACER" IF /I "%MAN%"=="PBELL" SET MAN2=PBELL&goto :SERIAL
    IF /I "%MAN2%"=="HP" IF /I "%MAN%"=="COMPAQ" SET MAN2=COMPAQ&goto :SERIAL
    IF /I "%MAN2%"=="LENOVO" IF /I "%MAN%"=="IBM" SET MAN2=IBM&goto :SERIAL
    IF NOT DEFINED MAN2 SET MAN2=%MAN%&goto :SERIAL
    :SERIAL
    ::scan 'oemscan.ini' once with the provided 'Manufacturer|OS|Edition' -> if not matched, set the manufacturer (serial) to 'DEFAULTOEM' (Acer) & try again -> ('findstr' -> word start|end '\<','\>')
    IF /I "%WINVER%"=="10" GOTO :WIN810
    IF /I "%WINVER%"=="8" GOTO :WIN810
    IF NOT DEFINED WINVER GOTO :BRANDING
    IF NOT DEFINED EDITION GOTO :BRANDING
    IF EXIST %OEMS% for /f "tokens=1,2,3,4 delims=|" %%a in ('type %OEMS% ^| findstr /I "\<%%EDITION%%\>" ^| findstr /I "\<%%MAN2%%\>"') do (echo %%a | findstr /I "\<%WINVER%\>" >nul &&%INL% set PIDKEY=%%d)
    IF NOT DEFINED PIDKEY set REALMAN=%MAN2%&set MAN2=DEFAULTOEM&goto :SERIAL
    IF /I "%MAN2%"=="DEFAULTOEM" set MAN2=%REALMAN%
    :ACTIVATION
    ::create 'activate.cmd' -> 'CALL' -> from 'OOBE.cmd' for 'WIN7' or 'SetupComplete.cmd' for 'VISTA'
    (echo @echo off & echo. & echo :ACTIVATE & echo ::apply serial:: & echo cscript //nologo %windir%\system32\slmgr.vbs -ipk %PIDKEY% ^>^nul & echo ::apply certificate ^& 2nd, 3rd, 4th, etc, if available::
    echo IF EXIST "%windir%\Setup\scripts\Certificates\%MAN2%.xrm-ms" for /f "tokens=*" %%%%A in ^('DIR /B "%windir%\Setup\scripts\Certificates\%MAN2%*.xrm-ms"'^) DO ^(
    echo cscript //nologo %windir%\system32\slmgr.vbs -ilc "%windir%\Setup\scripts\Certificates\%%%%A" ^>^nul^) & echo IF EXIST "%windir%\Setup\scripts\oemscan.ini" DEL /F /Q "%windir%\Setup\scripts\oemscan.ini" ^>^nul
    echo IF EXIST "%windir%\Setup\scripts\Certificates\" DEL /S /F /Q "%windir%\Setup\scripts\Certificates\*.*" ^>^nul ^&^& RD /S /Q "%windir%\Setup\scripts\Certificates" ^>^nul) >"%windir%\Setup\scripts\activate.cmd"
    IF /I NOT "%WINVER%"=="VISTA" GOTO :OOBE
    ::'VISTA only' check 'SetupComplete.cmd' exists -> 'NO' rename|edit 'activate.cmd' -> 'YES' -> edit existing 'SetupComplete.cmd'
    IF NOT EXIST %windir%\Setup\scripts\SetupComplete.cmd (move /Y %windir%\Setup\scripts\activate.cmd %windir%\Setup\scripts\no4.txt >nul
    (echo RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >%windir%\Setup\scripts\no3.txt 
    copy /b %windir%\Setup\scripts\no4.txt+%windir%\Setup\scripts\no3.txt %windir%\Setup\scripts\SetupComplete.cmd >nul & del /F /Q %windir%\Setup\scripts\no4.txt >nul %windir%\Setup\scripts\no3.txt >nul
    ) ELSE (Type %windir%\Setup\scripts\SetupComplete.cmd | findstr /I /V /C:"@echo off" >%windir%\Setup\scripts\no2.txt && del /F /Q %windir%\Setup\scripts\SetupComplete.cmd >nul
    (echo @echo off & echo. & echo IF EXIST %windir%\Setup\scripts\activate.cmd CALL %windir%\Setup\scripts\activate.cmd ^>^nul ^&^& DEL /F /Q %windir%\Setup\scripts\activate.cmd ^>^nul) >%windir%\Setup\scripts\no1.txt 
    copy /b %windir%\Setup\scripts\no1.txt+%windir%\Setup\scripts\no2.txt %windir%\Setup\scripts\SetupComplete.cmd >nul & del /F /Q %windir%\Setup\scripts\no1.txt >nul %windir%\Setup\scripts\no2.txt >nul)
    GOTO :BRANDING
    :WIN810
    %windir%\Setup\scripts\Rw.exe /Min /NoLogo /command="ACPI Dump MSDM";"RwExit" /logfile=%windir%\Setup\scripts\msdm.log
    for /f "Skip=1 tokens=2 delims=    " %%A in ('find "-" %windir%\Setup\scripts\msdm.log') do %INL% set DM=%%A
    cscript //B %windir%\system32\slmgr.vbs /ipk %DM% >nul
    cscript //B %windir%\system32\slmgr.vbs /ato >nul
    IF EXIST "%windir%\Setup\scripts\msdm.log" DEL /F /Q "%windir%\Setup\scripts\msdm.log" >nul
    GOTO :BRANDING
    :OOBE
    ::check • apply created 'activate.cmd' -> from this 'OOBE.cmd'
    IF EXIST %windir%\Setup\scripts\activate.cmd cd /d %windir%\Setup\scripts\ && CALL "activate.cmd" >nul
    IF EXIST %windir%\Setup\scripts\activate.cmd DEL /F /Q %windir%\Setup\scripts\activate.cmd >nul
    :BRANDING
    ::check • set 'MAN=?' -> if exist 'Force_Theme_[readme].txt' || edit brand '.reg file' -> if installing 'Starter' Edition
    IF EXIST "%windir%\Setup\scripts\Rw.exe" DEL /F /Q "%windir%\Setup\scripts\Rw.exe" >nul
    cd /d %windir%\Setup\scripts\OEM's\ && for /r %%G in (.) DO IF EXIST %%G\Force_Theme_[readme].txt DEL /F /Q %%G\Force_Theme_[readme].txt >nul &&set MAN=%%~nG
    IF EXIST "%windir%\Setup\scripts\Force_Theme_[readme].txt" DEL /F /Q "%windir%\Setup\scripts\Force_Theme_[readme].txt" >nul
    IF /I NOT "%EDITION%"=="STARTER" GOTO :CONTINUE
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" (cd /d %windir%\Setup\scripts\OEM's\%MAN%\ >nul & Type %MAN%.reg | findstr /I /V "InstallTheme" >STARTER.reg && MOVE /Y "STARTER.reg" "%MAN%.reg" >nul)
    :CONTINUE
    ::finalize branding|theme
    IF NOT EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" goto :TRANSFERS
    start /w regedit /s "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\%MAN%.reg" >nul
    for /f "tokens=2* delims=     " %%A IN ('REG QUERY "HKLM\HARDWARE\DESCRIPTION\System\BIOS" /v SystemProductName') DO %INL% set SYSPDT=%%B
    IF NOT DEFINED SYSPDT (goto :TRANSFERS) else IF DEFINED VOID1 IF /I "%SYSPDT%"=="%VOID1%" (goto :TRANSFERS) else IF DEFINED VOID2 IF /I "%SYSPDT%"=="%VOID2%" (goto :TRANSFERS) else IF DEFINED VOID3 IF /I "%SYSPDT%"=="%VOID3%" (goto :TRANSFERS) else IF DEFINED VOID4 IF /I "%SYSPDT%"=="%VOID4%" (goto :TRANSFERS) else IF DEFINED VOID5 IF /I "%SYSPDT%"=="%VOID5%" (goto :TRANSFERS)
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /f /v "Model" /t REG_SZ /d "%SYSPDT%" >nul
    :TRANSFERS
    ::check • screen resolution -> movements|actions
    %windir%\Setup\scripts\MultiMonitorTool.exe /HideInactiveMonitors 1 /stext %windir%\Setup\scripts\monitor.txt
    for /f "tokens=2,3 delims=,: " %%i in ('type %windir%\Setup\scripts\monitor.txt ^| find /i "Right-Bottom"') do %INL% set RESLN=%%iX%%j
    IF EXIST "%windir%\Setup\scripts\MultiMonitorTool.exe" DEL /F /Q "%windir%\Setup\scripts\MultiMonitorTool.exe" >nul
    IF EXIST "%windir%\Setup\scripts\monitor.txt" DEL /F /Q "%windir%\Setup\scripts\monitor.txt" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\%RESLN%.jpg" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\%RESLN%.jpg" "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\%RESLN%.jpg" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\%RESLN%.jpg" "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" REN "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "BACKGROUNDDEFAULT.bak" >nul && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\*.jpg" >nul & REN "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.bak" "BACKGROUNDDEFAULT.jpg" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" REN "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "WALLPAPER.bak" >nul && DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\*.jpg" >nul & REN "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.bak" "WALLPAPER.jpg" >nul
    :TRANSFER1
    ::check • 'Vista' -> movements|actions
    IF /I NOT "%WINVER%"=="VISTA" goto :TRANSFER2
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\backgrounds" cd /d %windir%\Setup\scripts\OEM's\%MAN%\ && RD /S /Q "backgrounds" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" REN %windir%\Web\Wallpaper\img24.jpg img24.bak && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "%windir%\Web\Wallpaper\img24.jpg" >nul
    :TRANSFER2
    ::check • 'Win8.x and Win 10' -> movements|actions
    IF /I "%WINVER%"=="VISTA" GOTO :TRANSFER3
    IF /I "%WINVER%"=="7" GOTO :TRANSFER3
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" MD "%systemdrive%\$%MAN%$\Account" >nul && MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" "%systemdrive%\$%MAN%$\Account\user.bmp" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user.bmp" "user.bmp.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.bmp" >nul && COPY /Y "%ProgramData%\Microsoft\User Account Pictures\user.bmp.bak" "%systemdrive%\$%MAN%$\Account\original.bmp" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user.png" "user.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.png" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user-40.png" "user-40.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user-40.png" >nul
    IF EXIST "%systemdrive%\$%MAN%$\Account\user.bmp" REN "%ProgramData%\Microsoft\User Account Pictures\user-200.png" "user-200.png.bak" >nul && COPY /Y "%systemdrive%\$%MAN%$\Account\user.bmp" "%ProgramData%\Microsoft\User Account Pictures\user-200.png" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\OOBE.xml" DEL /F /Q "%windir%\Setup\scripts\OEM's\%MAN%\OOBE.xml" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" TAKEOWN /F "%windir%\Resources\Themes\*.theme" >nul & ICACLS "%windir%\Resources\Themes\*.theme" /reset /T /Q >nul & ICACLS "%windir%\Resources\Themes\*.theme" /grant:r "%windir%\Resources\Themes\*.theme:(OI)(CI)F" 2>nul & REN "%windir%\Resources\Themes\aero.theme"  theme3.theme >nul & MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" "%windir%\Resources\Themes\aero.theme" >nul
    IF EXIST "%windir%\Web\Screen\img100.jpg" TAKEOWN /F "%windir%\Web\Screen\*.jpg" >nul & ICACLS "%windir%\Web\Screen\*.jpg" /reset /T /Q >nul & IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" MD "%systemdrive%\$%MAN%$\LockScreen" >nul && MOVE /Y "%windir%\Web\Screen\img100.jpg" "%systemdrive%\$%MAN%$\LockScreen\original.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%systemdrive%\$%MAN%$\LockScreen\LockScreen.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%windir%\Web\Screen\img100.jpg" >nul
    IF EXIST "%windir%\Web\Screen\img100.png" TAKEOWN /F "%windir%\Web\Screen\*.png" >nul & ICACLS "%windir%\Web\Screen\*.png" /reset /T /Q >nul & IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" MD "%systemdrive%\$%MAN%$\LockScreen" >nul && MOVE /Y "%windir%\Web\Screen\img100.png" "%systemdrive%\$%MAN%$\LockScreen\original.png" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%systemdrive%\$%MAN%$\LockScreen\LockScreen.jpg" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\Backgrounds\BACKGROUNDDEFAULT.jpg" "%windir%\Web\Screen\img100.png" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" MD "%systemdrive%\$%MAN%$\Desktop" >nul && COPY /Y "%windir%\Setup\scripts\OEM's\%MAN%\WALLPAPER.jpg" "%systemdrive%\$%MAN%$\Desktop\Desktop.jpg" >nul
    IF EXIST "%systemdrive%\$%MAN%$\" MOVE /Y "%systemdrive%\$%MAN%$" "%windir%\$%MAN%$" >nul
    ::Enables f8 key for Win 8.x and Win 10 in desktops and laptops |  To disable this feature for tablets put :: in front of the line below
    bcdedit /set {default} bootmenupolicy legacy >nul
    :TRANSFER3
    ::check • 'Windows OS' -> movements|actions
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\USER.bmp" "%ProgramData%\Microsoft\User Account Pictures\user.bmp" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" MOVE /Y "%windir%\Setup\scripts\OEM's\%MAN%\*.theme" "%windir%\Resources\Themes\$OEM$.theme" >nul
    IF EXIST "%windir%\Setup\scripts\OEM's\%MAN%\*.*" MD "%windir%\system32\oobe\info" 2>nul & for /f "delims==" %%F IN ('dir "%windir%\Setup\scripts\OEM's\%MAN%\*.*" /s /b') DO MOVE /Y "%%F" "%windir%\system32\oobe\info\" 2>nul
    cd /d %windir%\Setup\scripts\
    IF EXIST "%windir%\Setup\scripts\OEM's\" DEL /S /F /Q "%windir%\Setup\scripts\OEM's\*.*" >nul && RD /S /Q "%windir%\Setup\scripts\OEM's" >nul
    IF /I "%WINVER%"=="VISTA" GOTO :CLOSE
    IF EXIST "%windir%\Setup\scripts\Certificates\" DEL /S /F /Q "%windir%\Setup\scripts\Certificates\*.*" >nul && RD /S /Q "%windir%\Setup\scripts\Certificates" >nul
    IF EXIST "%windir%\Setup\scripts\oemscan.ini" DEL /F /Q "%windir%\Setup\scripts\oemscan.ini" >nul
    ::===============================================================================================================
    ::===============================================================================================================
    ::ACTIVATION
    :Choice2
    if "%layout%"=="False" if "%edition%"=="Enterprise" goto :KMSInstall
    if "%layout%"=="False" if "%edition%"=="Professional" goto :ActivationChoice
    if "%layout%"=="True" if "%edition%"=="Enterprise" goto :KMSInstall
    if "%layout%"=="True" if "%edition%"=="Professional" goto :ActivationChoice
    if "%layout%"=="True" if not "%edition%"=="Enterprise" goto :MessageBox
    if "%layout%"=="True" if not "%edition%"=="Professional" goto :MessageBox
    goto :LoaderChoice
    :MessageBox
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments>%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0))>>%file% 
    %file% "BootTask" "^!^!^!GPT Layout detected^!^!^! Skipping activation." 48
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :Choice3
    :ActivationChoice
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments>%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0))>>%file% 
    %file% "BootTask" "Windows Loader (Yes) or KMS (No) ?" 36
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :LoaderChoice
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :KMSInstall
    :LoaderChoice
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments>%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0))>>%file% 
    %file% "BootTask" "Install Windows Loader ?" 36
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :LoaderInstall
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice3
    ::===============================================================================================================
    ::LOADER INSTALL
    :LoaderInstall
    cls
    echo --------------------------------------------------------------------------------
    echo WINDOWS LOADER by Daz
    echo --------------------------------------------------------------------------------
    echo:
    %~dp0"Windows Loader.exe" /silent
    goto:Choice3
    ::===============================================================================================================
    ::KMS ACTIVATION
    :KMSInstall
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments>%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0))>>%file% 
    %file% "BootTask" "Install KMS Server by CODYQX4 ?" 36
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :KMS
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice3
    :KMS
    cls
    echo --------------------------------------------------------------------------------
    echo KMS Server by CODYQX4
    echo --------------------------------------------------------------------------------
    echo:
    set port=1688
    md "%windir%\KMSServerService" >nul
    xcopy "KMS Server Service %vera%.exe" /s /q "%windir%\KMSServerService" /Y >nul
    ren "%windir%\KMSServerService\KMS Server Service %vera%.exe" KMSServerService.exe
    netsh advfirewall firewall add rule name="KMSServerService %port%" dir=in  program="%windir%\KMSServerService\KMSServerService.exe" localport=%port% protocol=TCP action=allow remoteip=any
    netsh advfirewall firewall add rule name="KMSServerService %port%" dir=in  program="%windir%\KMSServerService\KMSServerService.exe" localport=%port% protocol=TCP action=allow remoteip=localsubnet
    REG ADD HKLM\SYSTEM\CurrentControlSet\services\KMSServer /v Description /t REG_SZ /d "Windows Service that emulates a Key Management Service (KMS) Server" /f >nul
    REG ADD HKLM\SYSTEM\CurrentControlSet\services\KMSServer\Parameters /f /v "KMSPort" /d %port% /t "REG_SZ" >nul
    REG ADD HKLM\SYSTEM\CurrentControlSet\services\KMSServer\Parameters /f /v "KMSPID" /d "RandomKMSPID" /t "REG_SZ" >nul
    REG ADD HKLM\SYSTEM\CurrentControlSet\services\KMSServer\Parameters /f /v "KMSHWID" /d "364F463A8863D35F" /t "REG_SZ" >nul
    REG ADD HKLM\SYSTEM\CurrentControlSet\services\KMSServer\Parameters /f /v "VLActivationInterval" /d "120" /t "REG_DWORD" >nul
    REG ADD HKLM\SYSTEM\CurrentControlSet\services\KMSServer\Parameters /f /v "VLRenewalInterval" /d "10080" /t "REG_DWORD" >nul
    REG ADD HKLM\SYSTEM\CurrentControlSet\services\KMSServer\Parameters /f /v "KillProcessOnPort" /d "1" /t "REG_DWORD" >nul
    sc create KMSServerService binPath= "%windir%\KMSServerService\KMSServerService.exe" type= own error= normal obj= "NT AUTHORITY\NetworkService" start= demand DisplayName= KMSServerService
    SCHTASKS /Create /TN "Reactivate Service DAILY" /TR "%windir%\KMSServerService\reactivate.cmd" /SC DAILY /MO 1 /RU SYSTEM /RL Highest /F
    SCHTASKS /Create /TN "Reactivate Service ONLOGON" /TR "%windir%\KMSServerServicereactivate.cmd" /SC ONLOGON /RU SYSTEM /RL Highest /F
    SCHTASKS /Create /TN "Reactivate Service ONSTART" /TR "%windir%\KMSServerService\reactivate.cmd" /SC ONSTART /RU SYSTEM /RL Highest /F
    >"%windir%\KMSServerService\reactivate.cmd" (
    echo @echo off
    echo :: Code by s1ave77
    echo cls
    echo echo:
    echo sc start KMSServerService ^>nul
    if /i "%edition%"=="Enterprise" echo cscript %windir%\system32\slmgr.vbs /ipk 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
    if /i "%edition%"=="Professional" echo cscript %windir%\system32\slmgr.vbs /ipk FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
    echo cscript %windir%\system32\slmgr.vbs /skms 127.0.0.2:%port%
    echo cscript %windir%\system32\slmgr.vbs /ato
    echo sc stop KMSServerService ^>nul
    echo exit
    )
    sc start KMSServerService
    if /i "%edition%"=="Enterprise" cscript %windir%\system32\slmgr.vbs /ipk 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
    if /i "%edition%"=="Professional" cscript %windir%\system32\slmgr.vbs /ipk FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
    cscript %windir%\system32\slmgr.vbs /skms 127.0.0.2:%port%
    cscript %windir%\system32\slmgr.vbs /ato
    sc stop KMSServerService
    ::===============================================================================================================
    ::===============================================================================================================
    ::NET INSTALL
    :Choice3
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments>%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0))>>%file% 
    %file% "BootTask" "Install .Net Framework ?" 36
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :NetInstall
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Choice4
    :NetInstall
    cls
    echo --------------------------------------------------------------------------------
    echo .NET INSTALL
    echo --------------------------------------------------------------------------------
    echo:
    "%~dp0net4install.exe" /silent
    ::===============================================================================================================
    ::===============================================================================================================
    :Choice4
    set file=%temp%\messagebox.vbs
    echo set args=WScript.Arguments>%file% 
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0))>>%file% 
    %file% "BootTask" "Reboot (mandatory for Loader) ?" 36
    IF %ERRORLEVEL% EQU 6 del /s /q %file% >nul && call :Reboot
    IF %ERRORLEVEL% EQU 7 del /s /q %file% >nul && call :Exit
    ::===============================================================================================================
    :Reboot
    ::finished -> remove 'scripts' dir ('RunOnce' Reg entry) -> self delete 'OOBE.cmd'
    (echo @echo off & echo. & echo IF EXIST "%windir%\Setup\scripts\" RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >"%windir%\Cleanup.cmd"
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v !Clean /t REG_SZ /d "%windir%\Cleanup.cmd" /f >nul
    Timeout /T 8 >nul
    DEL /F /Q %0% >nul
    ENDLOCAL
    shutdown.exe /r /t 0
    ::===============================================================================================================
    :Exit
    ::finished -> remove 'scripts' dir ('RunOnce' Reg entry) -> self delete 'OOBE.cmd'
    (echo @echo off & echo. & echo IF EXIST "%windir%\Setup\scripts\" RD /S /Q "%windir%\Setup\scripts" ^>^nul & echo DEL /F /Q %%0%% ^>^nul) >"%windir%\Cleanup.cmd"
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v !Clean /t REG_SZ /d "%windir%\Cleanup.cmd" /f >nul
    Timeout /T 8 >nul
    DEL /F /Q %0% >nul
    ENDLOCAL
    exit
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    #74 Mr.X, Nov 27, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Thanks s1ave77. Two quick questions:
    1. Does the powershell part of the script will work in Windows 7 setup program and files?
    2. Does the setupcomplete.cmd file remain the same as the original one?

    Ed.~Just asking because it didn't work.

    Is this OK?
    Code:
    Certificates
    OEM's
    boottask.cmd
    Keys.ini
    KMS Server Service x64.exe
    KMS Server Service x86.exe
    MultiMonitorTool.exe
    net4install.exe
    oemscan.ini
    Rw.exe
    setupcomplete.cmd
    Windows Loader.exe
    
     
  15. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    What exactly failed ... tested with running Win 7, but afaik the moment the script is performed should allow this. In my tests it worked (didn#t touch/test the OEM stuff.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    List looks OK.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    Doing Enterprise x86 on VMware. It pop ups :LoaderChoice msgbox instead of :KMSInstall msgbox.
     
  18. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    Ahh, thought it fails completely ... this must be a minor checking error :g: Having a late meal atm and runinng a Test Pro Install to check.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    #79 s1ave77, Nov 27, 2014
    Last edited by a moderator: Apr 20, 2017
    As in all my tests so far there was no difference in script behavior between running from within Windows and at FirstLogon Stage (when bootask runs). My Test with Professional proved it. Activation choice was displayed (tested the KMS Install which went smoothly, installed the Professional GVLK and activated the system).

    Conclusion script gathers System values correctly, else it wouldn't show the double if choice:
    Code:
    if "%layout%"=="False" if "%edition%"=="Professional" goto :ActivationChoice
    (is only processed when both if(s) are true, means MBR and Pro)

    Good starting point, as querying DISKPART via CMD is a major PITA . In opposite to powershell and other tools it doesn't provide switches and only accepts input from a TXT file.


    GOOD NEWS: Actually no need to test during Setup, when it runs within Windows, it runs in Setup likewise.


    Have no Enterprise to test :cool2:. So we need to check this tomorrow. We'll find the error, i'm ~101,9% sure :good3:.


    For the better look: Change the value 4 in following line in :Choice1 to 36
    Code:
    %file% "BootTask" "Run OEM Branding ?" 4
    Result: 4 (determines that it shows YES and NO buttons) + 0 (button most left is default one) + 32 (value for question mark icon) = 36
    So it shows that icon :D Did it for the other choices but forgot one.

    More values for the VBS boxes:
    Constant Rendered button(s)
    0 "Ok" button
    1 "Ok" AND "Cancel" buttons
    2 "Abort", 'Retry", AND "Ignore" buttons
    3 "Yes", 'No", AND "Cancel" buttons
    4 "Yes" AND "No" button
    5 "Retry" AND "Cancel" button
    Default button table:​
    Constant Rendered button(s)
    0 The first button from the left is the default button
    256 The second button from the left is the default button
    512 The third button from the left is the default button
    768 The fourth button from the left is the default button
    Icon image table:​
    Constant Rendered image
    16
    [​IMG]
    32
    [​IMG]
    48
    [​IMG]
    64
    [​IMG]
    0
    Blank​
    http://www.javascriptkit.com/javatutors/vbalert.shtml

    Hi hi hi, just noticed that it offers option to set 4th button from left as default, but you can only create 3 of them :cool2:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    #80 Mr.X, Nov 28, 2014
    Last edited: Nov 28, 2014
    (OP)
    Looking it at this very moment... Tomorrow I'll resume, thanks a lot. :worthy:

    Ed~No good for me :(
    Think it's time to... you know what I told you by pm.