Skip to content

Instantly share code, notes, and snippets.

@maynero
Last active February 21, 2021 01:14
Show Gist options
  • Select an option

  • Save maynero/66df4886599c2d80a045c7e4b94f8a4c to your computer and use it in GitHub Desktop.

Select an option

Save maynero/66df4886599c2d80a045c7e4b94f8a4c to your computer and use it in GitHub Desktop.
Inject VirtIO drivers to WDS boot image

Inject VirtIO drivers to WDS boot image

This assumes that you already have (and know) the following:

  1. Windows 10 installation iso
  2. Windows ADK - https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install
  3. VirtIO windows drivers iso - https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md

Procedures

  1. Extract the boot.wim (to a location easily accessible, C:\Temp) from windows installation media. It should be located at the sources directory inside the iso file.
  2. Open Deployment and Imaging Tools Environment as administrator. If you don't see this is your program list then you probably don't have Windows ADK installed or you didn't include the neccessary components during installation.
  3. Get the index of Microsoft Windows Setup (x64) from the boot.wim file by executing this ommmand
DISM /get-wiminfo /wimfile:"C:\Temp\boot.wim"

dism_wiminfo\

  1. Create a directory named wimmount in C:\Temp\
  2. Extract the VirtIO windows drivers to C:\Temp\virtio-win-0.1.190
  3. Execute the following series of commands to inject the drivers. This cover most of the drivers. Don't try to recurse the whole virtio drivers directory since it will most likely fails since some drivers are unsigned.
@REM Mount boot.wim file to C:\Temp\wimmount
DISM /Mount-Image /ImageFile:"C:\Temp\boot.wim" /index:2 /MountDir:"C:\Temp\wimmount"

@REM Inject Balloon drivers
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\Balloon\w10\amd64" /recurse
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\Balloon\2k19\amd64" /recurse
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\Balloon\2k16\amd64" /recurse

@REM Inject NetKVM drivers
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\NetKVM\w10\amd64" /recurse
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\NetKVM\2k19\amd64" /recurse
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\NetKVM\2k16\amd64" /recurse

DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\amd64\w10" /recurse
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\amd64\2k19" /recurse
DISM /Image:"C:\Temp\wimmount" /Add-Driver /Driver:"C:\Temp\virtio-win-0.1.190\amd64\2k16" /recurse

@REM Unmount boot.wim and commit the changes
DISM /UnMount-Image /MountDir:"C:\Temp\wimmount" /Commit
  1. Voila, you now copy C:\Temp\boot.wim to your WDS server and replace your existing image.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment