Creating bootable media is an age-old practice that is still used today. Whatever the reason, I see people struggle with a particular return message that the WIM is too big for the USB – even if the USB has plenty of space. There is a simple explanation and an easy fix – one that I decided to automate with PowerShell.
The issue is that the USB is formatted with fat32 and the WIM exceeds the file size limit of fat32 – it has nothing to do with the available space on the USB drive itself. To resolve this, you need to split your WIM with DISM. To split the WIM, just launch an elevated command prompt and run the following:
Dism /Split-Image /ImageFile:C:\sources\install.wim /SWMFile:C:\sources\install.swm /FileSize:4096
Once it is finished, copy the SWM files over to the <MEDIA>\sources folder. The setup.exe engine will know what to do from here.
Now to the PowerShell script. Below is the script I use and it will work for Windows client and server ISOs. You basically run it and point to both the USB drive letter and the ISO and it will do the rest. I also have optional switches to point to a custom WIM file or a custom autounattend.xml file. The script will format the USB drive with fat32, copy the source files over, determine the size and split the WIM if it exceeds the limitations.
For example, (USB drive letter is D: and the ISO is located in my Downloads folder):
You can find the script at https://github.com/ftrout/powershell-tools/blob/master/create-usb-from-iso/Convert-ISO2USB.ps1