Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

How to create a bootable USB for Windows Server 2019 installation?

  • February 20, 2019
  • 12 min read
IT and Virtualization Consultant. Dmitriy is specializing in Microsoft technologies, with a focus on storage, networking, and IT infrastructure architecture.
IT and Virtualization Consultant. Dmitriy is specializing in Microsoft technologies, with a focus on storage, networking, and IT infrastructure architecture.

Introduction

Since Windows Server 2019 release, the Internet is booming with its reviews. Someday, I maybe write my own one too. Till then, why don’t we focus on something more important than just listing new Windows Server features? In today’s post, I share the scripts for creating and formatting bootable USB disks for Windows Server.

I came up with the idea of this short guide after reading the following article:

https://www.thomasmaurer.ch/2018/07/create-a-usb-drive-for-windows-server-2019-installation.

In fact, Thomas did a great job, but his scripts can be improved! With this being said, today, I present my universal scripts based on ones developed by Thomas and improved with my experience and comments to his post in mind.

DISCLAIMER: You can try out the scripts form this article, but you are the only person responsible for the consequences!

Look at your hardware first

OS installation may sometimes be a challenging task. Especially, when it comes to selecting and creating a bootable device. By the way, did you know that apart from USB, there are at least 3 other storage media that can be used as Windows installation disks? USB is more convenient for that purpose, IMHO, so let’s just stick to it. Of course, you can use Rufus to create a bootable USB. But, it is always good to know an alternative, right? And, it is better NOT to rely on some weird 3rd party software…

Picking a bootable disk partition type that is compatible with your hardware is not that straightforward too. Before creating such device, you need to think whether OS can be installed on your hardware afterward. For instance, a device with MBR partition type can be started only on a PC or server that supports BIOS. Devices with GPT partition type, in turn, require UEFI. So, take a closer look at your hardware first!

The Toolkit used

Here are things needed to create a bootable USB:

  • Windows 10 PC. You need it to run the scripts. Note that several PowerShell commands may be unavailable.
  • 8 GB USB drive. Windows Server consumes at least 4 GB, but it is always good to have some extra space. So, obviously, you cannot create a bootable USB of lower capacity.
  • Installation image (*.iso) for copying Windows Server 2019 distributive files.
  • A device to test the bootable USB. It can be a PC, server, or VM.

Creating a bootable USB for Windows Server 2019

Initially, find a Windows Server 2019 installation image. You can download it and read about the OS itself at the official website:

https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2019.

The script for creating a bootable USB described here is good for older Windows Server versions too. I tried it for Windows Server 2016, it worked good. Do you remember that I said at the beginning that I made universal scripts?

Here’s briefly how my script for creating a Windows Server bootable USB works:

  1. All drives connected to the system are scanned after starting the script. I have fine-tuned it such that only USBs are listed. One more time, you can use one only if its volume exceeds 8GB.
  2. Select any USB disk from that list.
  3. The disk you choose becomes a bootable USB. Note that all data are wiped out from that drive! By default, a GPT volume formatted as FAT32 is created. But, you can also create an MBR volume formatted as NTFS.
  4. Mounting Windows Server 2019 bootable image.
  5. Copying files and directories from the mounted image to the USB.
  6. While being written to a GTP disk, the image will be automatically split into 3GB chunks if the image keeping install.wim files is larger than 4GB. File splitting involves a temporary folder creation, so you need from 4 through 8GB of free space on the system disk therefor.
  7. Once script finishes, the disk where the image resides gets automatically unmounted.

To run the script, save its body locally as “Create-USB-Drive.ps.1”.

Next, start PowerShell as Administrator. Run the script with this cmdlet:

I guess it is good to discuss each piece of this command.

  • .\Create-USB-Drive.ps1 stands for the script name.
  • -ISOImg “C:\Temp\Win_Srv_2019.iso” represents the path to the *.iso image. Keep the script in that directory (it is just more convenient).
  • -DriveName “New Usb Drive Name” – the new USB drive name. By default, it is called Boot-Drive.
  • -BootType “Boot Type” allows setting the firmware interface for booting (UEFI or BIOS). UEFI is set by default.

Boot Type

Select the necessary disk afterward. Or, you can exit the script.

Necessary disk

Now, finally, the script comes. Once it finishes, you can start installing the OS.

Reformatting the Drive after Windows installation

Now, let’s take a look at my script for reformatting a USB. Here’s briefly how it works:

  1. Once the script is started, all disks connected to the system are scanned, but only USBs are listed. This script works for USB disks of any size.
  2. WARNING: IF YOU DO RUN THIS SCRIPT, DATA ON THE SELECTED USB IS WIPED OUT! You can create either a GPT volume or MBR one. Also, you can format the file system as FAT32, exFAT, FAT, or NTFS. Just input the appropriate parameter.

Save locally the body of the script provided below as Return-USB-Drive.ps1 file. Next, open PowerShell console as administrator, and you can run the script with the command below:

Let’s discuss what each part of the command stands for.

  • -DriveName “New Usb Drive Name” the new name of the USB disk. By default, it is called My Flash Drive.
  • -PartStyle ” Partition style ” – the partition table format (GPT or MBR). It is set to GPT by default.
  • -FSType “File system format” allows changing the type of file system formatting.

My Flash Drive

Select the disk which you want to reformat. Otherwise, you can exit the script.

Select the disk which you want to reformat

Here’s the script that I was talking about. Once it finishes, the disk is ready.

Conclusion

The scripts discussed in this post allow creating a bootable USB drive for installing Windows Server 2019 or Windows Server 2016. I did not reinvent the wheel here. I just improved the existing scripts considering both what people say and my experience. I hope that my way to create a Windows Server installation disk comes in handy!

Hey! Found Dmitriy’s insights useful? Looking for a cost-effective, high-performance, and easy-to-use hyperconverged platform?
Taras Shved
Taras Shved StarWind HCI Appliance Product Manager
Look no further! StarWind HCI Appliance (HCA) is a plug-and-play solution that combines compute, storage, networking, and virtualization software into a single easy-to-use hyperconverged platform. It's designed to significantly trim your IT costs and save valuable time. Interested in learning more? Book your StarWind HCA demo now to see it in action!