When you convert a Windows Install ISO to a .imgPTN file and boot from the .imgPTN partition (via the CSM Menu or UEFI booting), Windows will see a 'flat-file' structure, with all the folders and files directly accessible in the .imgPTN partition(s).
WARNING: If you use an .IMGPTN+XML file which automatically partitions and formats a drive, then as soon as you 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!
When you boot from the E2B .imgPTN partition, Windows will behave in the same way as if you just copied the files to a USB bootable drive.
In particular, Windows 8/10 will usually ask you for a Product Key.
You can automate the entry of a Product Key and many other Windows settings by adding an unattend.xml file to the image as follows:
You may also find the SDI_choco feature of E2B (for automatic driver, application install and Windows Updates) useful here.
Method 1. If your E2B USB drive is a Removable Flash drive
Create an AutoUnattend.xml file and copy it to the root of the image (i.e. inside the .imgPTN file).
You must first select the .imgPTN file using \_ISO\SWITCH_E2B.exe or boot to E2B, e.g. Run E2B and select the .imgPTN file and run it so that you see the CSM Menu displayed - then unplug the E2B USB drive and connect it to a Windows system.
Then copy the AutoUnattend.xml file to the root of the USB drive.
A minimal AutoUnattend.xml file for Windows 8/8.1 which includes a product key is here.
WARNING: If your XML file partitions and formats the drive, if you UEFI-boot, it will immediately wipe your hard disk!
See also Method 3 below.
Method 2. If your E2B USB drive is NOT a Removable Flash drive
Windows will only automatically load a \AutoUnattend.xml file from a Removable USB flash drive - an easy way to be able to use an E2B .imgPTN file from a hard disk, is to simply add a small Removable USB flash drive that contains your \AutoUnattend.xml file.
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!
If this is too cumbersome or you don't want to use a second flash drive, then you must modify the boot.wim file. This is the best solution for automated UEFI installation.
Tip: Use Split_WinISO.exe and Method 3 below - this automates the modification of the boot.wim file.
2a. Use GImageX to Mount the \sources\boot.wim file - usually a boot.wim will contain more than one image and image #2 is the one that we need to select.
You need to make an empty folder on your Windows drive in order to mount the image from the boot.wim file - I used F:\mount1
Click Mount to mount the image below the Mount Point folder.
An alternative tool is MagicIso (but it is not free).
You should now see that all the files under F:\mount1 are the files that are inside the boot.wim image.
Image #2 is usually the Setup image inside the boot.wim file.
Note: Ensure there is enough spare space on the Source drive for another copy of the boot.wim file.
Tip: If the boot.wim file will not mount, create a new Mount Point folder - sometime the previous empty mount point folder will refuse to work, even after a reboot!
2b. Copy your AutoUnattend.xml file to the root of the mounted folder (e.g. F:\mount1\AutoUnattend.xml or F:\mount1\Unattend.xml)
Note: if you XML file does not contain a WindowsPE pass - name the file \Unattend.xml.
A minimal Unattend.xml file for Windows 8/8.1 which includes a product key is here.
e.g. to just include a product key:
2c. Tick Commit Changes, click on the entry in the lower box to highlight it and then Unmount to save the changes to boot.wim
This method requires that you edit the boot.wim file every time you make a change.
Tip: An easy way to create an AutoUnattend.xml file is to use the Windows Answer File Generator and the XMLtoE2B.exe converter utility.
Tip: If you have named the file AutoUnattend.xml and it is not detected by Setup, rename it to Unattend.xml.
WARNING: If your XML file partitions and formats the drive, if you UEFI-boot, it will immediately wipe your hard disk!
Method 3. Easily changeable AutoUnattend.xml (select from a number of different XML files)
Tip: See Split_WinISO section below for an automated way to create .imgPTN files - STeps 1 - 4 below (recommended).
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
\Auto.cmd \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.
Tip: in case of trouble, look in the log file X:\Windows\Panther\Setupact.log for 'Logging new OS to BB' and the next few lines after that - it should report a AutoUnattend.xml file was found.
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)
FOR %%i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %%i:\Auto.cmd set UNAT=%%i:
if not exist %UNAT%\Auto.cmd echo Could not find Auto.cmd & pause & exit
echo Choose an option
echo 1 Install Windows 8.1 Core
echo 2 Install Windows 8.1 Professional
echo 3 Choose later and enter the Product Key manually
set /p ask=Please choose :
if "%ask%"=="" goto :loop
if "%ask%"=="1" set XML=AutoUnattend.xml
if "%ask%"=="2" set XML=AutoUnattendP.xml
if "%ask%"=="3" set XML=AutoUnattendBlank.xml
if "%XML%"=="" goto :loop
You can edit auto.cmd to add more XML files, e.g. Win8 Core MBR, Win8 Pro MBR, Win8 Core UEFI, Win8 Pro UEFI.
Split_WinISO will automatically make a boot.wim file for you and insert the auto.cmd file and sample XML files (steps 1 - 4) - see below for details.
Note: We do not have to use Setup.exe and XML files to install Windows from the Auto.cmd file. Instead you could use a combination of Diskpart and Dism to partition and install Windows using scripting - see this page for examples.
Chandra's Split_WinISO.exe utility can be used to automatically add the required files into boot.wim (image #2) and it will also split large WIM\ESD files and add a sample auto.cmd plus XML files too!
2. Run Split_WinISO.exe, select an ISO file (ensure that at least one Install.WIM\ESD has been found). Tip: Ensure there are no spaces or strange characters in the path or ISO name!
3. If the Install.ESD\WIM is over 4GB, use the CONVERT button - otherwise use the MPI button.
You will be prompted with a few questions and then the .imgPTN file will be made.
Say 'Yes' when asked if you want to inject the winpeshl.ini and MySetup.cmd files into the boot.wim image #2 (see screenshot above). This also adds a sample auto.cmd file. This is useful if you want to use various XML files (e.g. for a choice of various SDI_CHOCO XML files or other types of XML files).
Now just switch to it (using SWITCH_E2B.exe) and edit the auto.cmd file as required and add any XML files to the partition volume that you need.
Note that you should use standard Microsoft Windows ISOs.
If you accept the boot.wim modification (for winpeshli.ini and auto.cmd, etc.) then All-In-One ISOs may not work (they may not use Image #2 or they may not run winpeshl.exe). So for AIO ISOs, say No to the boot.wim modification prompt.
Tips on making an AutoUnattend.xml file
A good start to making an automated install is to use the handy online xml file generator WAFG for Win7/8/8.1/10 here. This generates an xml file that can be used on both 32-bit and 64-bit versions - there are separate entries for each of the two CPU types (i.e. there are two entries for every setting so make sure you change both occurrences!). Note that the install can be fully unattended and will just wipe you internal hard disk without asking!
The WAFG XML file however needs tweaking before it will work with E2B (or a multiple-image Install.wim). You can use the XMLtoE2B.exe converter utility to make the WAFG XML file fully automated and change it to use GPT partitions for UEFI installs.
Editing the XML file without using XMLtoE2B
XMLtoE2B makes converting the WAFG XML file for use with E2B really easy, but if you don't have it then read the instructions below to see how to manually edit an XML file.
Detailed instructions can be found in my blog article here.
Once you have made the xml file using Windows AFG and try to use it, you will find that it still initially prompts the user for which version of Windows to use (e.g. Starter, Home, Basic, Pro, Ultimate, etc.).
To prevent this, you need to add the following section shown in red (the black text should be already present:
Fig. 1 Add this section to avoid being prompted for which version of Windows you want
Note that the exact name (e.g. "Windows 7 PROFESSIONAL") of the Windows version can be found using 7zip and examining the 1.xml file shown inside the root of the \sources\Install.wim file. The top xml file shows you which versions are present inside the Install.wim file and the correct spelling.
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).
You will also need to specify a Product Key that matches the version you specify (again, it occurs twice). A generic key can be used for installation purposes.
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.
The \sources\ei.cfg file is ignored (if present).
If you want the user to be prompted to input their own ComputerName near the end of the installation, delete the two ComputerName lines (i.e. the word "ComputerName" should not be present anywhere inside the xml file) and make sure the SkipMachineOOBE setting is false in both places - otherwise a random name based on the UserName will be automatically chosen - e.g. User1-TGY347.
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 0 to 1 (or use one of the Disk1_VM_Only .diskcfg files when using XMLtoE2B).
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.