The All Covered Advanced Technology Solutions team writes scripts to help our engineers speed up repetitive tasks using automation, in this case I am improving upon a script written by Johan Arwidmark to prepare multiple USB drives for Windows installation.

Many thanks to Johan Arwidmark over at Deployment Research for creating the basic script to handle this process! All credit goes to Johan for his original script used here.

You can use this tool to create a bootable USB drive from any Windows installation media for Windows 8.1/Server 2012 and forward.

Improvements to the existing script

I chose to improve upon this basic script to make it more functional for the masses. Here’s what I’ve added:

  • Source location picker, so you can easily select the source location for the ISO contents
  • Drive label option, to set a label for the USB drive(s) you’re preparing
  • Administrative check to make sure you’re running the script as administrator, if you are not the script will exit
  • Check for connected USB drives, if the script doesn’t find any the script will exit

Getting Started

To get started, you’ll need some USB drives. In my case, I needed to format about 100 USB drives for imaging. I decided to follow Johans lead and grabbed this Anker 13 Port USB Hub. I also opted to use these Lexar 64 GB USB Drives. I recommend using a desktop computer with a good USB 3.0 controller. What does good mean? I don’t know, but something more powerful than what’s in a Lenovo W541 laptop! My controller became exhausted of all available power at 8 USB drives connected, which slowed my process slightly.

Be sure to connect the USB hub or drives to a USB 3.0 port on the system, or you’ll have rather dismal performance during the preparation of the drive(s).

In addition, I found that due to the intense load on the USB hub when formatting more than one batch of USB drives I had to cool mine with a desk-fan in order to keep the USB hub from becoming unstable during the process. In my case I believe it was overheating and as a result disconnecting and re-connecting from the system.

Do Not use this process if you have any other USB mass storage devices connected to the machine from which you are running this script. This will risk wiping any USB drives connected. You will be provided the opportunity to review the list of drives to be formatted and choose to proceed to the next step before formatting any drives.

Executing the script

Plug in your USB drives to your computer. Or, alternatively, the USB hub if you’re using one and follow these steps:

  1. Download and execute this script from an administrative PowerShell window
  2. Select the folder or drive which contains the contents of the ISO image you want to useSteps 1 and 2
  3. Select a Label for the drive(s)Step-3
  4. Validate the list provided to make sure only USB drives you want to format are connected and continue (Press Enter)Step-4
  5. Wait for the process to complete.Step-5

When complete, the script will attempt to eject the USB drives for safe removal. Note: Sometimes this process can fail just click retry and it should eventually properly eject the media.

The Code

This code can also be downloaded here on GitHub.


Johnathan Milgie