Adding VirtIO drivers to Windows Recovery Environment (Windows RE)

Photo of author
Written By Jan Reilink

Windows Server system administrator & enthusiast.

If you need to add VirtIO drivers to your Windows Recovery Environment (Windows RE) to recover your Windows virtual machine, here is how. The following steps come in handy if you found out the hard way you don’t see any disks in Windows RE after a hard crash. As have I…

Windows Recovery Environment (Windows RE)

Windows Recovery Environment (WinRE) is a recovery environment that can repair common causes of unbootable operating systems. WinRE is based on Windows Preinstallation Environment (Windows PE), and can be customized with additional drivers, languages, Windows PE Optional Components, and other troubleshooting and diagnostic tools. By default, WinRE is preloaded into the Windows 10 and Windows 11 for desktop editions (Home, Pro, Enterprise, and Education) and Windows Server 2016, and later, installations.

Customize your Windows System Restore (how-to)

The following steps worked for me repeatedly to create a new Winre.wim image file with additional VirtIO drivers: vioscsi and netkvm. I could easily copy the new image over the existing C:\Recovery\WindowsRE\Winre.wim file, and reboot into Windows RE to verify it worked. All steps come from Microsofts Customize Windows RE documentation, I merely added some additional information.

In a nutshell, virtio is an abstraction layer over devices in a paravirtualized hypervisor. Virtio was developed as a standardized open interface for virtual machines (VMs) to access simplified devices such as block devices and network adaptors.


  1. Windows VirtIO Drivers ISO (
  2. Windows Server 2019/2022 ISO, or its install.wim file
  3. winre.wim file, extracted from install.wim (see below)

You can extract the contents of your Windows Server and VirtIO drivers ISO to a location on a file server (which is preferable), or you can mount them using DISM:

$virtioImg = Mount-DiskImage -ImagePath \\fileserver\path\to\drivers\virtio-win\virtio-win-0.1.208.iso -NoDriveLetter mountvol "F:" $($virtioImg | Get-Volume).UniqueId $winservImg = Mount-DiskImage -ImagePath \\fileserver\path\to\iso\2022\SW_DVD9_Win_Server_STD_CORE_2022__64Bit_English_DC_STD_MLF_X22-74290.ISO -NoDriveLetter mountvol "G:" $($winservImg | Get-Volume).UniqueId
Code language: PHP (php)

Now you have your VirtIO drivers available on driver letter F:, and your Windows Server ISO on G:.

If you mount Windows Server ISO, you cannot commit changes back into the .ISO file, as it’s read-only. So extracting its contents is preferable. This is what I have done for this guide. Let’s continue.

Step 1: Mount all .WIM images using DISM

First you need to mount your .WIM image files into a location, because winre.wim resides within install.wim. The following steps copies your existing install.wim file to c:\mount, mounts it into c:\mount\windows2019 and mounts winre.wim into c:\mount\winre.

md c:\mount md c:\mount\windows2019 md C:\mount\winre Copy-Item G:\Sources\install.wim C:\mount\ # if necessary, remove the read-only flag attrib C:\mount\install.wim -r Dism /Mount-Image /ImageFile:C:\mount\install.wim /Index:1 /MountDir:C:\mount\windows2019 Dism /Mount-Image /ImageFile:C:\mount\windows2019\windows\system32\recovery\winre.wim /Index:1 /MountDir:C:\mount\winre
Code language: PHP (php)

Step 2: Add Red Hat VirtIO SCSI pass-through controller (vioscsi) driver to the image using DISM

Now you have mounted all WIM files, you can start adding drivers. First one up is Red Hat VirtIO SCSI pass-through controller (vioscsi) driver:

Dism /image:c:\mount\winre /Add-Driver /Driver:"F:\vioscsi\2k19\amd64\vioscsi.inf"
Code language: JavaScript (javascript)

Second driver is Red Hat VirtIO Ethernet Adapter (NetKVM) for networking:

Dism /image:c:\mount\winre /Add-Driver /Driver:"f:\NetKVM\2k19\amd64\netkvm.inf"
Code language: JavaScript (javascript)

You can verify the drivers were added using DISM /get-drivers and /get-driverInfo parameters. Here you see the vioscsi driver was added

PS C:\Users\janreilink> Dism /image:C:\mount\winre\ /get-driverInfo /driver:oem0.inf Deployment Image Servicing and Management tool Version: 10.0.17763.1697 Image Version: 10.0.17763.107 Driver package information: Published Name : oem0.inf Driver Store Path : C:\mount\winre\Windows\System32\DriverStore\FileRepository\vioscsi.inf_amd64_580a262bfd85344b\vioscsi.inf Class Name : SCSIAdapter Class Description : Storage controllers Class GUID : {4D36E97B-E325-11CE-BFC1-08002BE10318} Date : 8/30/2021 Version : Boot Critical : Yes Drivers for architecture : amd64 Manufacturer : Red Hat, Inc. Description : Red Hat VirtIO SCSI pass-through controller Architecture : amd64 Hardware ID : PCI\VEN_1AF4&DEV_1004&SUBSYS_00081AF4&REV_00 Service Name : vioscsi Compatible IDs : PCI\VEN_1AF4&DEV_1004 Exclude IDs : Manufacturer : Red Hat, Inc. Description : Red Hat VirtIO SCSI pass-through controller Architecture : amd64 Hardware ID : PCI\VEN_1AF4&DEV_1048&SUBSYS_11001AF4&REV_01 Service Name : vioscsi Compatible IDs : PCI\VEN_1AF4&DEV_1048 Exclude IDs : The operation completed successfully.
Code language: JavaScript (javascript)

Neat, heh :)

Step 3: Optimize the image

This step is not really required, but it’s time to optimize the image and shave off some bytes.

Dism /Image:c:\mount\winre /Cleanup-Image /StartComponentCleanup

When this command finishes, you need to unmount the WinRE image

Step 4: Unmount WinRE image and commit changes

If you want to save the new WinRE image, you must unmount it and commit the changes:

Dism /Unmount-Image /MountDir:C:\mount\winre /Commit

It should otuput something like:

Saving image [==========================100.0%==========================] Unmounting image [==========================100.0%==========================] The operation completed successfully.
Code language: CSS (css)

Next you can verify the last write date of the file to make sure it was written correctly:

Get-ItemProperty C:\mount\windows2019\Windows\System32\Recovery\Winre.wim | select -ExpandProperty LastWriteTime Tuesday, November 23, 2021 9:38:37 AM

Step 4: Optimize WinRE image, part 2

You can also optimize an image by exporting to a new image file, using the export-image parameter. So export the Windows RE image into a new Windows image file and replace the old Windows RE image with the newly-optimized image.

Dism /Export-Image /SourceImageFile:c:\mount\windows2019\windows\system32\recovery\winre.wim /SourceIndex:1 /DestinationImageFile:c:\mount\winre-optimized.wim del c:\mount\windows2019\windows\system32\recovery\winre.wim copy c:\mount\winre-optimized.wim c:\mount\windows2019\windows\system32\recovery\winre.wim

Step 5: Unmount the Windows install image

Last but not least, unmount the Winodws install image and commit the changes (e.g the new winre.wim file):

Dism /Unmount-Image /MountDir:C:\mount\windows2019 /Commit

Depending on where you got your install.wim image from, you either need to create a new ISO, copy the file into an unpacked ISO location (\Sources dir), or copy and overwrite C:\Recovery\WindowsRE\Winre.wim:

xcopy c:\mount\winre-optimized.wim C:\Recovery\WindowsRE\Winre.wim /h /r

Test and boot into Windows RE using REAgentC

To manually boot into the Windows Recovery Environment you can use REAgentC.exe tool if you’re unable to press a function key during boot. For example in a cloud environment.

You can use the REAgentC.exe tool to configure a Windows Recovery Environment (Windows RE) boot image and a push-button reset recovery image, and to administer recovery options and customizations. REAgentC comes with Windows, and you can run the REAgentC command on an offline Windows image or on a running Windows operating system.

REAgentC command-line options

In your administrative shell, execute the following REAgentC command:

reagentc /boottore
Code language: PowerShell (powershell)

Followed by a shutdown / reboot command: shutdown /r /f /t 0.

You can also reboot the computer in WinRE mode from the command prompt using the -o parameter of the shutdown command: shutdown /f /r /o /t 0. But this cannot be executed when connected through RDP (“The parameter is incorrect (87)” appears).

Did you like: Adding VirtIO drivers to Windows Recovery Environment (Windows RE)

Then please, take a second to support Sysadmins of the North and donate!

Your generosity helps pay for the ongoing costs associated with running this website like coffee, hosting services, library mirrors, domain renewals, time for article research, and coffee, just to name a few.

Hi! Join the discussion, leave a reply!