My ramblings on the stuff that holds it all together
Making Something Run When a Windows PE 2.0 CD/DVD Starts.
I need a DVD that automatically applies a .WIM image when WinPE boots – no prompts; just want to press F9 for the BIOS Boot menu and walk away until build is finished.
I built a WinPE 2.0 image the usual way, but I want to add files to it (easy with PowerISO) but I want it to do something when it starts up..
To do this I had to customise the BOOT.WIM file which you use to generate your WinPE ISO file, note you need to edit BOOT.WIM not the WinPE.WIM file.
I used the /MOUNTRW switch for imageX (more details here) to mount the BOOT.WIM file – if you look in it’s WINDOWS\SYSTEM32 directory there is a file called STARTNET.CMD – this is mostly the same as a batch file so you can put whatever commands you want in here, in my case I edited it as follows;
Once the changes are made you can save the changes back using the /UNMOUNT and /COMMIT switches – you’ll then need to rebuild the Windows PE .ISO using OSCDIMG.EXE.
You can then inject files into the .ISO file you’ve generated – you could put them in the BOOT.WIM as above but its quicker and easier to do this via PowerISO (or similar tool) if you are going to need to make changes, rather than recompiling the BOOT.WIM and .ISO files.
This is the BUILDPC.BAT batch file that STARTNET.CMD calls, it prepares the disk and deploys the image file to the local HDD.
diskpart /s d:\sources\wipedisk.txt
Echo applying image
imagex.exe /apply d:\sources\MasterImageFile.wim 1 C:
Echo Image Downloaded, rebooting.
Save the file and burn.. job done.
It’s a good idea to use a virtual machine to test the .ISO file out – and is cheaper than wasting lots of DVD/CD-R’s while you are fine-tuning!