Automating Windows Installs from .imgPTN files
WARNING: If you add an XML file which automatically partitions and formats a drive, then as soon as you UEFI-boot, it will destroy the disk contents of any system you connect it to. In particular, if you UEFI-boot from a .imgPTN file there will be no menu or other warning at all! Be careful that you don't just pick up an E2B USB drive in this state and just UEFI-boot from it - it may wipe your system disk!I highly recommend using the Auto.cmd method #3. below, to avoid this problem (or use an Image Index value of 99 so that you are required to press a key)!
You may also find the SDI_choco feature of E2B here (for automatic driver, application install and Windows Updates).
Method 1. If your E2B USB drive is a Removable Flash drive
Method 2. If your E2B USB drive is NOT a Removable Flash drive
Note: recent versions of Windows 10 (e.g. 1803+) will detect a \AutoUnattend.xml file in the root of a 'Fixed-disk' type of USB drive. So try Method 1 first as it is easier!
Note: MPI 0.068+ - if you boot to the CSM Menu (MBR mode), the CSM menu will copy the contents of the \AutoUnattend.xml file to the \AutoUnattend.xml file on your WinHelper USB drive. So all you need to do is place the \AutoUnattend.xml file in your .imgPTN partition and connect a WinHelper USB drive. If you want to UEFI-boot however, you must first boot to the CSM menu (do NOT use a VM), or ensure that the correct \AutoUnattend.xml file is on the WinHelper drive.WARNING: Note that if you UEFI-boot from the E2B drive in this state (switched to .imgPTN partition) on ANY UEFI-system, there will be no warning whatsoever and the target hard disk will immediately be wiped and formatted, if your XML is set up to do this!
Method 3. Easy to change AutoUnattend.xml (select from a number of different XML files)
This process is a bit more complicated than Method 2 above, but it allows you to easily change the \AutoUnattend.xml file which is located in the root of the image (i.e. it is not inside the \sources\boot.wim file) or we can even allow the user to select from a range of XML files.
This method causes Windows Setup to search for \auto.cmd and run it. This allows us specify any XML file we like.
This method was tested using a Murphys AIO - Win7SP1_5in1-x86-Aug2015-en-US.iso (Size: 3.57 GB SHA-1: 4DA0D82FDF22222BB018C61EA5DB743EC7974AA8).
1. Mount the boot.wim file as in method 2 above using GimageX (make sure you select the Setup image - usually #2 - inside the boot.wim file)
2. Copy in the winpeshl.ini and mysetup.cmd file to the windows\system32 folder of the mounted boot.wim image - e.g. F:\mount1\windows\system32
The download for these files is here. It is best to copy the \sources\boot.wim file to your Windows hard disk before you mount it, then modify it and delete the one on the USB drive and replace it with the new one.
3. Commit the changes and Unmount boot.wim (close ALL Explorer windows first or you may get an error!)
Note: if you have problems with unmounting the boot.wim, check it is not corrupt by remounting it and ensure that the new files are still present. You may need to make a new Mount folder (e.g. \mount2) or reboot your Windows system before it will remount - it is quite temperamental and does not always work after a few times!
4. Copy the Auto.cmd file and your AutoUnattend.xml file to the root of your E2B USB drive (that is the image partition which should have \sources folder and \boot folder)
We now need to add\change XML files(s) and edit the auto.cmd file...
E2B .imgPTN partition
\Sources\boot.wim <<< contains winpeshl.ini and mysetup.cmd in the \windows\system32 folder.
You can now edit or replace the sample \AutoUnattend.xml as desired.
X:\Windows\Panther\Setupact. Tip: in case of trouble, look in the log file log for 'Logging new OS to BB' and the next few lines after that - it should report a AutoUnattend.xml file was found. If not then look in X:\Windows\Setupact.log.
You can even prompt the user (using auto.cmd) and ask them which one of several unattend.xml files they want to use if you change the script in the \Auto.cmd file.
I highly recommend using a auto.cmd file to prompt the user, even if you only have one XML file, because it also prevents you from accidentally booting from the USB drive and immediately wiping the system's internal hard disk without warning!
Each xml file can have different Product Keys and other settings.
E2B .imgPTN partition
\AutoUnattend.xml (to be edited)
\AutoUnattendP.xml (not supplied)
\AutoUnattendBlank.xml (can be used for normal install)
\Auto.cmd (modified as below)
\Sources\boot.wim <<< contains new winpeshl.ini and mysetup.cmd in the \windows\system32 folder
\Auto.cmd (replace the contents of Auto.cmd with these lines)
Tip: Ensure there are no spaces or strange characters in the path or ISO name!
Tips on making an AutoUnattend.xml file
Editing the XML file without using XMLtoE2B
You will need to insert the red text twice, because the OSImage section occurs twice - once for 32-bit and once for 64-bit (amd64).
The Windows utility XMLtoE2B.exe will convert the output of the Windows Answer File Generator to the correct format for an automated install.
It is available on request, to anyone who has made a donation of £10 or more. I will include a licence file to make it fully functional.
If you want the user to be prompted to input their own ComputerName near the end of the installation, delete the
Fig.2 Delete completely the two ComputerName lines, if you want the end user to be prompted to enter a machine name (SkipMachineOOBE=false).
To enable the Administrator account, set the AutoLogon UserName to Administrator. If you do not add any User Accounts in the XML file, then you will be prompted to create a User Account at the end of the build unless you set SkipMachineOOBE to true.
Testing Automated Windows 8/8.1/10 MBR and UEFI installs using a Virtual Machine
When booting from an E2B USB drive using a VM, the E2B USB drive should be Drive 1 and the Virtual Hard disk should be Drive 0 - otherwise the E2B USB drive (drive 0) will be wiped!
Also, the E2B USB drive will be seen as a 'Fixed Disk' (even if it is a Removable Flash drive)
Unfortunately, Virtual Box + DavidB's VMUB utility can only boot from the USB drive as Drive 0, so we need to make sure Windows is installed to Drive 1 not Drive 0, as follows:
1. Create an XML answer file using WAFG+XMLtoE2B.exe (see here for details).
2. Edit the XML answer file using NotePad and change all occurences of DiskID
3. Using MakePartImage, convert your Windows 8/8.1/10 Install ISO to a FAT32 partition image using the MPI_FAT32 shortcut. Copy it to \_ISO\MAINMENU on the E2B Drive.
4. Boot to E2B (e.g. using DavidB's VMUB utiity) and run the Windows .imgPTN menu entry to get to the CSM menu - then exit (F10).
5. You should now see the contents of the .imgPTN partition on the E2B USB drive using Windows Explorer (e.g. \Sources folder)
6. Add the XML file to the root of the \Sources\boot.wim file as described above using GImageX (file must be called AutoUnattend.XML).
Note: if you want to be able to easily update the XML file in future or choose from a selection of XML files, refer to the '3. Easily changeable AutoUnattend.xml' heading on this page. For instance, you can have different XML files for Win8 Core, Win8 Pro, MBR and UEFI\GPT installs.
7. (optional) Boot to the E2B USB drive in MBR mode and switch back to the E2B menu. Then copy the .imgPTN file to your system hard drive - this is a backup file in case things go wrong!.
8. (optional) Boot to the E2B USB drive in MBR mode and select the .imgPTN file again. Quit at the CSM menu.
9. Now boot from the VM in UEFI mode or MBR\BIOS mode (32-bit or 64-bit) as required using DavidB's VMUB utility. The install should proceed automatically to the virtual disk 1.
UEFI VM - When the installation completes do not reboot (otherwise the Windows Install will start again and wipe Drive 1!). You can now check the install worked as expected within Windows.
10a. MBR VM - When Windows reboots, press F7 in the CSM menu to boot from the virtual hard disk.
10b. UEFI VM - If you want to boot again to Windows on Disk 1, run Virtual Box manager and delete the E2B USB .vmdk entry under Storage (e.g. SATA0) leaving just the Virtual Disk drive as disk 1 (SATA1 or IDE slave) as shown below. Now boot from the UEFI VM (do NOT use DavidB's VMUB utiity) and it will boot to Windows each time from the Virtual disk 1.
If you use DavidB' VMUB utility to boot from the E2B USB drive, it will add back in the USB drive (.vmdk) and then it will boot from the E2B USB drive again and a Windows Install will start again.
Boot it in MBR\Legacy mode to return back to the E2B Main menu (use CSM menu option 0) - or run the \e2b\Restore_e2b.cmd batch file from Windows or run \_ISO\SWITCH_E2B.exe and click on the 'Restore E2B partitions' button.
Recommended for Easy2Boot (fastest!) - SanDisk Extreme SDCZ880-128G-G46