Code: W:\Windows\System32\bcdboot W:\Windows /l en-us /s S: /f BIOS Turns out the error I have been seeing is the language being (attempted) to be added. WinPE doesn't support that option or something, idk. So I have shortened the code to just Code: W:\Windows\System32\bcdboot W:\Windows /s S: /f BIOS As for whether or not running it from W:\ bcdboot maters or not, I do not think it does at least not with 8.1 which is what I have been testing from but for now I have added that extra little bit. Only real issue I am having now is getting logs dir to be set to the variable. Will get back.
It is a good practice to copy winre.wim specially if you are applying an image directly. Or If you run the WindowsSetup.exe and if you have the tools partition then WindowsSetup.exe will add winre.wim
Thanks. Seems not a lot of ppl are interested in this little project. I am trying to think of which language I want to learn to code this in- need to leave batch behind :/
Very nice work, Humphrey. I like this. Is there somewhere I can get the complete script(s) or do I have to piece everything together from the snippets in this post. I know I could develop all of this myself, but I can't see re-inventing the wheel if someone has already done it.
Works well. Code: diskpart /s D:\CreatePartitions.txt dism /Apply-Image /ImageFile:D:\sources\install.wim /Index:1 /ApplyDir:W:\ md T:\Recovery\WindowsRE attrib "W:\Windows\System32\Recovery\WinRE.wim" -h -s -r copy W:\Windows\System32\Recovery\WinRE.wim T:\Recovery\WindowsRE\WinRE.wim W:\Windows\System32\bcdboot W:\Windows /l en-us /s S: /f UEFI W:\Windows\System32\reagentc /setreimage /path T:\Recovery\WindowsRE /target W:\Windows CreatePartitions.txt: Code: sel dis 0 cle con gpt cre par pri size=350 for fs=ntfs label="Windows RE tools" quick set id="DE94BBA4-06D1-4D40-A16A-BFD50179D6AC" gpt attributes=0x8000000000000001 assign letter="T" cre par efi size=100 for quick fs=fat32 label="System" assign letter="S" cre par msr size=128 cre par pri for quick fs=ntfs label="System" assign letter="W" lis vol exit
Just now seeing your post StartNet.CMD Code: :: StartNet.CMD :: Placed in System32 of WinPE @ECHO OFF :: Setup for InstallOS.cmd wpeutil UpdateBootInfo for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET DetectFirm=%%B :: Note: delims is a TAB followed by a space. if %DetectFirm%==0x1 SET FIRMWARE=BIOS if %DetectFirm%==0x2 SET FIRMWARE=UEFI :: Add script to detect files needed. for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do SET LOGDIR=%%p:\Logs 2>nul for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do %%a:\installos.cmd %LOGDIR% %firmware% 2>nul :EXIT Here is InstallOS 1.3. Afaik it functions fully for the most part. I've not ran this in a while. Feel free to edit as needed. Code: :: InstallOS.CMD v1.3 :: Written by: Humphrey :: :: Runs from Windows PE to create partitions, apply a Windows image file, and setup the boot record. :: In this version, BIN and IMAGES need to be in the same folder as InstallOS.CMD :: @ECHO OFF :: SETUP SetLocal EnableDelayedExpansion CD /D %~dp0 FOR /F "TOKENS=*" %%A IN ('TIME/T') DO SET NowT=%%A & FOR /F "TOKENS=*" %%A IN ('DATE/T') DO SET NowD=%%A SET BIN=.\bin\& SET IMGDIR=!BIN!Images\ :MAIN TITLE Humphreys OS Installer :: Main Menu / OS Selection ECHO. ECHO. Select which Windows version to install. ECHO. ECHO. 1] Windows Vista ECHO. 2] Windows 7 ECHO. 3] Windows 8 ECHO. SET /P VER=What version to install?: IF "!VER!"=="" CLS & GOTO :MAIN SET SVER=!VER! & CLS :ARCHSEL :: Architecture Menu ECHO. ECHO. 1] x32 (x86) ECHO. ECHO. 2] x64 ECHO. SET /P ARCHSEL=What architecture to install?: IF "!ARCHSEL!"=="" CLS & GOTO :ARCHSEL IF "!ARCHSEL!"=="1" (SET Arch=x86& CLS) else SET Arch=x64& CLS :PARTMENU :: Partitioning Menu ECHO. ECHO.!FIRMWARE! was detected on boot. ECHO. ECHO. 1] MBR BIOS ECHO. ECHO. 2] GPT uEFI ECHO. SET /P PARTITION=What parition scheme to use?: IF "!PARTITION!"=="" CLS & GOTO :PARTMENU IF "!PARTITION!"=="1" SET PART=MBR& SET BOOT=W:\Windows\System32\bcdboot W:\Windows /s S: /f BIOS& CLS IF "!PARTITION!"=="2" SET PART=GPT& SET BOOT=W:\Windows\System32\bcdboot W:\Windows /s S: /f UEFI& CLS GOTO :!SVER! :1 :: WinVista SET IMGFILE=\v ECHO. ECHO. Windows Vista (!ARCH!) ECHO. ECHO. 1] Home Basic ECHO. 2] Home Premium ECHO. 3] Ultimate ECHO. SET /P EDI=What edition to install?: IF "!EDI!"=="" CLS & GOTO :1 IF "!EDI!"=="1" SET IMGINDX=2& SET CHK= Windows Vista Home Basic& CLS & GOTO :CHK IF "!EDI!"=="2" SET IMGINDX=3& SET CHK= Windows Vista Home Premium& CLS & GOTO :CHK IF "!EDI!"=="3" SET IMGINDX=4& SET CHK= Windows Vista Ultimate& CLS & GOTO :CHK CLS & GOTO :1 :2 :: Win7 SET IMGFILE=\7 ECHO. ECHO. Windows 7 (!ARCH!) ECHO. ECHO. 1] Home Basic ECHO. 2] Home Premium ECHO. 3] Professional ECHO. 4] Ultimate ECHO. SET /P EDI=What edition to install?: IF "!EDI!"=="" CLS & GOTO :2 IF "!EDI!"=="1" SET IMGINDX=1& SET CHK= Windows 7 Home Basic& CLS & GOTO :CHK IF "!EDI!"=="2" SET IMGINDX=2& SET CHK= Windows 7 Home Premium&& CLS & GOTO :CHK IF "!EDI!"=="3" SET IMGINDX=3& SET CHK= Windows 7 Home Professional& CLS & GOTO :CHK IF "!EDI!"=="4" SET IMGINDX=4& SET CHK= Windows 7 Ultimate& CLS & GOTO :CHK :3 :: Win8.x SET EDI= ECHO. ECHO. 1] Windows 8 ECHO. ECHO. 2] Windows 8.1 ECHO. SET /P EDI=What edition to install?: IF "!EDI!"=="" CLS & GOTO :3 IF "!EDI!"=="1" SET IMGFILE=\8& SET CHK1=Windows 8& CLS & GOTO :4 IF "!EDI!"=="2" SET IMGFILE=\81& SET CHK1=Windows 8.1& CLS & GOTO :4 :4 :: Win8 Edition SET EDI= ECHO. ECHO. !CHK1! (!ARCH!) ECHO. ECHO. 1] Core ECHO. ECHO. 2] Professional ECHO. SET /P EDI=What edition to install?: IF "!EDI!"=="" CLS & GOTO :4 IF "!EDI!"=="1" SET IMGINDX=2 & SET CHK= Core& CLS & GOTO :CHK IF "!EDI!"=="2" SET IMGINDX=1 & SET CHK= Professional& CLS & GOTO :CHK :CHK ECHO.!LOGDIR! SET CONT= :: Install OS Check TITLE Install Check ECHO. ECHO.Start installation of: !CHK1!!CHK! (!ARCH!) [!PART!] ECHO. SET /P CONT=[Y]es / [N]o: IF "!CONT!"=="" CLS & GOTO :CHK IF /I "!CONT!"=="Y" CLS & GOTO :APPLYSETTINGS IF /I "!CONT!"=="N" SET PARTITION=& SET PART=& SET ARCHSEL=& SET EDI=& SET ARCH=& SET IMGFILE=& SET IMGINDX=& SET VER=& CLS & GOTO :MAIN CLS & GOTO :CHK :APPLYSETTINGS ECHO. :: Applies image file and creates the partitions tables and boot settings. DISKPART /S !BIN!!PART!.txt DISM /APPLY-IMAGE /IMAGEFILE:!IMGDIR!!ARCH!!IMGFILE!!ARCH!.wim /INDEX:!IMGINDX! /APPLYDIR:W:\ !BOOT! :LOG :: Outputs log of completed install. ECHO.Installed !CHK1!!CHK! !ARCH! on !NowD! @ !NowT! >>!LOGDIR!\Final.log Start CMD Directory listing Code: InstallOS.cmd (Located in the root of the boot media, called by StartNet.cmd) Also located in root of the boot media .\BIN\ .\BIN\Images .\BIN\x64 .\BIN\x64\7x64.wim .\BIN\x64\81x64.wim .\BIN\x64\8x64.wim .\BIN\x64\vx64.wim .\BIN\x86 .\BIN\x86\7x86.wim .\BIN\x86\81x86.wim .\BIN\x86\8x86.wim .\BIN\x86\vx86.wim .\BIN\Logs (Working on relocating these to the temp folder of the WinPE so they can actually be written and thusly, observed.) .\BIN\MBR.txt .\BIN\GPT.txt
Interesting humph... I've been working on a behemoth of a project myself about diskpart and setup... I got a link there in my sig... It's about 4x more complicated than your script there even, but it's getting a bit spaghetti-codish... I have the prototype on the link and then a later WIP later in the integration thread... You're welcome to borrow ideas bud..