Original Article: https://petri.com/create-a-bootable-usb-drive-for-windows-server-2019-installation/


How to Create a Bootable USB Drive for Windows Server 2019 Installation

Author avatar - Russell Smith

Russell Smith

|

JUN 16, 2021

Before you can install Windows Server 2019 on physical hardware, you’ll need boot media that contains all the files necessary to install Windows Server. Boot media generally comes in two forms: as a DVD or USB drive. As most modern server hardware comes without a DVD drive, in this article, I’ll show you how to create a bootable USB drive containing the Windows Server 2019 media.

Get the Windows Server 2019 .iso file

If you don’t have access to the Windows Server 2019 .iso directly from Microsoft or a partner, you can download an evaluation version from Microsoft’s website here. Regardless of where you obtain your installation media, save the .iso file to C:\Users\Public\Downloads.

ADVERTISMENT

Create a bootable USB drive

Before starting, you will need a USB drive with a capacity of at least 8GB. We will wipe the entire contents of the USB drive during the creation process, so make sure any valuable data is backed up. Because most modern server hardware uses UEFI instead of BIOS, we’ll create a bootable USB drive using a GUID Partition Table (GPT). UEFI-based systems cannot be booted from Master Boot Record (MBR) drives.

We’ll use Windows 10 to create the bootable USB drive. Connect the USB drive to your system and then follow the instructions below.

Logo for Petri IT Knowledgebase sponsor Devolutions

Sponsored Content

Centralize, Manage and Secure Remote Connections

Centralized remote connection technologies, remote machine data, password management and access control on a platform that is secure, scalable and refreshingly simple to use.

Learn More

  • Type powershell in the Search box in the bottom left of the taskbar. Make sure that Windows PowerShell is highlighted in the search results, and in the pane on the right of the Search panel, click Run as Administrator.
  • Give consent or enter an administrator username and password as prompted.
  • Find your downloaded Windows Server .iso file in C:\Users\Public\Downloads and rename it WindowsServer2019. To rename a file, select it in File Explorer (WIN+E) and then press F2. Make sure the file is called ‘windowsserver2019.iso’ and not ‘windowsserver2019.iso.iso’.

Now let’s put the full path of the downloaded file into a variable ($isopath):

$isopath = 'C:\Users\Public\Downloads\WindowsServer2019.iso'

Before we can format the USB drive, we need to establish the disk number Windows has assigned it. Run the command below to list all the USB drives attached to your device:

ADVERTISMENT

Get-Disk | Where-Object BusType -eq USB | Format-Table -AutoSize

I know that my USB drive is called ‘Patriot Memory’, so it is disk number ‘2’. Let’s create an object ($usb) for disk ‘2’. You should replace -eq 2 with the number of your USB drive.

$usb = Get-Disk | Where-Object Number -eq 2

Now, we’re going to delete all the data on the USB drive using Clear-Disk. Type y and press ENTER to confirm you want to delete all data on the drive. This is a good time to double-check that you have the correct disk number!

$usb | Clear-Disk -RemoveData
Create a Bootable USB Drive for Windows Server 2019 Installation (Image Credit: Russell Smith)

Format the USB drive

Now let’s make sure the disk is configured with a GUID Partition Table so that we can use it to boot UEFI systems.

$usb | Set-Disk -PartitionStyle GPT

Create a new volume on the drive using New-Partition. When prompted in the Format USB Drive dialog, format the volume using FAT32. You must use FAT32. Optionally, give the drive a volume name in the Volume label field. Click Start to format the USB drive. Click OK in the warning dialog to confirm that formatting the drive will erase all data.

ADVERTISMENT

Create a Bootable USB Drive for Windows Server 2019 Installation (Image Credit: Russell Smith)
$volume = $usb | New-Partition -UseMaximumSize -AssignDriveLetter

Close the Format USB Drive dialog once formatting is complete.

Copy the Windows Server 2019 media files to the USB drive

Now that we have configured the USB drive so that it can be used to boot our server hardware, all that’s left to do is copy the Windows Server media files to the USB drive. Let’s start by mounting the downloaded Windows Server .iso file to a drive in Windows 10.

$mount = Mount-DiskImage -ImagePath $isopath -StorageType ISO

Windows will assign the new mounted drive a letter. We can use Get-Volume to get the assigned drive letter:

$drive = ($mount | Get-Volume).DriveLetter

Now, let’s copy the entire contents of the mounted .iso file to the UBB disk using Copy-Item:

Copy-Item -Path ($drive +":\*") -Destination ($volume.DriveLetter + ":\") -Recurse

If Copy-Item exits with an error, it’s because it failed to copy the largest file, install.wim, to the USB drive. FAT32 has a file limit of 4GB and install.wim might be larger than the limit. To solve the problem, we can use the Windows 10 DISM tool to split the install.wim file into two smaller files: install.swm and install2.swm.

Create a Bootable USB Drive for Windows Server 2019 Installation (Image Credit: Russell Smith)

First, we’ll need to create the two new files on our local disk. In this example, I’ve chosen to create them in C:\Users\Public\Downloads. Note that you may need to replace ‘f’ in ‘f:\sources\install.wim’ with a different drive letter. Windows might have assigned a different drive letter to your mounted .iso file. You can check the drive letter Windows assigned by opening File Explorer (WIN+E).

dism /Split-Image /ImageFile:f:\sources\install.wim /SWMFile:C:\Users\Public\Downloads\install.swm /FileSize:4096
Create a Bootable USB Drive for Windows Server 2019 Installation (Image Credit: Russell Smith)

Now, let’s copy the two new files, install.swm and install2.swm, to our USB drive:

Copy-Item -Path C:\Users\Public\Downloads\install.swm -Destination ($volume.DriveLetter + ":\sources\install.swm")
Copy-Item -Path C:\Users\Public\Downloads\install2.swm -Destination ($volume.DriveLetter + ":\sources\install2.swm")
Create a Bootable USB Drive for Windows Server 2019 Installation (Image Credit: Russell Smith)

Finally, all that’s left to do is to unmount the Windows Server .iso file from our local device using Dismount-DiskImage:

Dismount-DiskImage -ImagePath $isopath

And that is it! Now you have a bootable USB drive that you can use to install Windows Server 2019 on modern server hardware.