As you move more modern deployment and get away from traditional imaging, there still comes a time when you as an IT admin need to cleanly install Windows 10 on a device. This could be due to hard drive failure., SSD upgrade, or the OS is too far corrupted to do a full PC reset. Or like me, sometimes you’re just lazy. Not only that, using a third party tool such as Rufus to make a Windows 10 ISO bootable to a USB drive can often not work due to varying hardware support for NTFS UEFI booting. The UEFI standard is most commonly implemented with FAT32 support. The downside is that the Win10 media can’t fit onto FAT32 because the install.wim file is over 4GB. The process I’ll document here will enable a super simple way to make a bootable USB drive with WIndows 10 Setup media that supports UEFI (and legacy) booting on the widest range of hardware. It will also fully install Win10 with zero-touch.
- 8 GB or larger USB key. I recommend using a fast drive such as Sandisk Extreme or an external SSD via USB 3.0
- Windows 10 Setup media downloaded from MS Volume license site or MSDN
- Laptop running Windows 10 1803 or newer (this is so you can actually see the multiple partitions on the USB key)
Go to the Github repo and download the “Create-Win10-Media.ps1” script. For those unfamiliar with downloading a script from Github, click on script and then “raw” and then right click the page and “save as” .
Once download, right click and then “Run with Powershell” (this will self elevate and run “as administrator”).
Before continuing with script, ensure you have downloaded the appropriate Windows 10 media from MS Volume License site, MSDN, or used the MediaCreationTool to create an ISO (I touch more on this tool at the end)
Right click the ISO and mount it with explorer so that it gets a drive letter assigned. In my case in will be “F:\”
At the beginning of the script, press enter to continue.
It will scan for any mounted USB drives. Confirm the mounted drive is correct.
Plug in your USB drive. The script will search for available USB drives and present you a list.
Select the drive number of the one you want (probably will be drive 1 as drive 0 is your internal disk). Press enter.
It will ask you to double check you have select the correct drive as it will wipe out the whole thing. If correct, hit “y”.
The script will then wipe the USB key and do the following:
- First partition will be a 500 MB FAT32 partition that holds all of the boot files from windows setup media
- The second partition will be the remaining space on the drive formatted as NTFS.
- This partition will only have the Sources folder which contains the install.wim file. FAT32 doesn’t support files sizes over 4 GB so we needed to make this partition NTFS formatted. It also gives much faster transfer speeds so Windows 10 installs very quickly.
Once the files are copied, it will prompt you to copy the Autounattend.xml file into the root of the “USB-BOOT” partition. Type Y and then enter.
This will enable Windows 10 Setup to be fully automated and zero touch. If you don’t include this file you’ll need to manually click through the Windows 10 setup wizard. More on this file later.
After this, it will prompt you which image index you want to apply. Most ISOs contain a number of different SKU. Select the image index number that matches the SKU you’d like to install.
This will update the “value” node under the <ImageInstall> section of the autounattend.xml file on the USB_BOOT partition.
We use a file called “autounattend.xml” to automate windows 10 setup process. Windows 10 setup will process this file if it resides in the root of the USB key. It acts like an unattend file for the WinPE setup process including formatting the disks, applying the correct SKU, and language. The one I include in this process is for GPT/UEFI as I am assuming you are going to be formatting it that way (yes, yes you definitely want to do this). But you can update it with MBR/Legacy boot mode. See MS documentation for some steps on how to do that as well as other things you can add to this file.
Let’s take a quick look at this file and what it is doing:
- Formatting Disk 0 in GPT format (edit the file to see each partition size)
- Modifies those partitions to be have correct format and ID (in the case of recovery partition)
- Set Language as English
- Sets Operating System SKU (based on the name of the OS image being applied).
We do add one tiny additional file (called ei.cfg) to tell windows to go ahead and format without Windows 10 product key. The script you ran above automatically creates it for you in the Sources folder on the NTFS formatted partition. If you neglect to include this file, then Windows 10 Setup will complain about invalid product key and error out.
And you’re done! Simply plug into any laptop (or VM) that is correctly set to boot EFI mode and boot to the USB drive (F12 on Dell machines, ESC on VMs, other devices might be different) and watch Windows 10 automatically install. On fast USB 3.0 media applying to a newer SSD laptop, I’ve seen install times as fast a 9 min! Here’s a quick video of this in action on a VM:
Microsoft Media Creator
One note on Microsoft’s tool. This tool does a similar thing as my script but it has some limitations:
- Each time you run it, it fully downloads the media from the internet. This makes it a much longer process if you are needing to re-do the process or setup multiple drives
- It is only the latest version of Windows. Right now, 1809 is the latest version, but if you needed 1803 or earlier it does not give you an option to select an earlier version.
- It is only Windows 10 Pro
- On the upside, the install.wim is compressed to under 4GB so it can fit on FAT32 partitions and thus allow you to have only 1 partition on the key (as opposed to 2 with my process)