If additional drivers are required for the server to work with Windows, you can add them to the OS template. You will need a Windows PC or virtual machine (VM) to add the drivers. 

This article discusses an example of adding drivers to Windows Server 2012 R2, 2016, 2019 templates. The DISM utility is used to edit the templates.

Preparation


  1. Prepare a Windows PC (VM). System requirements:
    1. OS version — Windows 10 or higher, Windows Server 2016 or higher;
    2. disk space — at least 70 GB for each template to be edited.
  2. Create a copy of the OS template.
  3. Download a copy of the template to a Windows PC (VM).

Example of adding


On the Windows PC (VM):

  1. Create directories:

    C:\win_update\
    C:\win_update\wim\
    C:\win_update\win_templates\
    C:\win_update\win_templates\2012\
    C:\win_update\win_templates\2016\
    C:\win_update\win_templates\2019\
    C:\win_update\updates\
    C:\win_update\updates\2012\
    C:\win_update\updates\2016\
    C:\win_update\updates\2019\
    CODE
  2. Download the required drivers and save them in the C:\win_update\updates\2012\, C:\win_update\updates\2016\, C:\win_update\updates\2019\.

    Example of directory structure


    If the version of Windows on the PC (VM) matches the version of Windows in the template, you can install the downloaded drivers and then import them into the required directory:

    Example of command

    DISM /online /export-driver /destination:C:\win_update\updates\2016
    CODE
  3. Save the boot.wim and install.wim files from the templates in the C:\win_update\win_templates\2012\, C:\win_update\win_templates\2016\, C:\win_update\win_templates\2019\ directories The boot.wim file is usually in the root directory of the template, the install.wim file is in the /sources directory.
  4. Open the Powershell command line and navigate to the directory with the templates and drivers:

    cd C:\win_update\
    POWERSHELL
  5. Add the drivers to the templates:

    1. Windows Server 2012 R2:

      1. To the boot.wim file:

        DISM /Mount-Wim /WimFile:win_templates\2012\boot.wim /Index:1 /Mountdir:wim
        DISM /image:wim /Add-Driver /Driver:updates/2012 /recurse
        DISM /Unmount-Wim /Mountdir:wim /commit
        POWERSHELL
      2. To the install.wim file:

        DISM /Mount-Wim /WimFile:win_templates\2012\install.wim /Index:2 /Mountdir:wim
        DISM /image:wim /Add-Driver /Driver:updates/2012 /recurse
        DISM /Unmount-Wim /Mountdir:wim /commit
        POWERSHELL
    2. Windows Server 2016:

      1. To the boot.wim file:

        DISM /Mount-Wim /WimFile:win_templates\2016\boot.wim /Index:2 /Mountdir:wim
        DISM /image:wim /Add-Driver /Driver:updates/2016 /recurse
        DISM /Unmount-Wim /Mountdir:wim /commit
        POWERSHELL
      2. To the install.wim file:

        DISM /Mount-Wim /WimFile:win_templates\2016\install.wim /Index:2 /Mountdir:wim
        DISM /image:wim /Add-Driver /Driver:updates/2016 /recurse
        DISM /Unmount-Wim /Mountdir:wim /commit
        POWERSHELL
    3. Windows Server 2019:

      1. To the boot.wim file:

        DISM /Mount-Wim /WimFile:win_templates\2019\boot.wim /Index:2 /Mountdir:wim
        DISM /image:wim /Add-Driver /Driver:updates/2019 /recurse
        DISM /Unmount-Wim /Mountdir:wim /commit
        POWERSHELL
      2. To the install.wim file:

        DISM /Mount-Wim /WimFile:win_templates\2019\install.wim /Index:2 /Mountdir:wim
        DISM /image:wim /Add-Driver /Driver:updates/2019 /recurse
        DISM /Unmount-Wim /Mountdir:wim /commit
        POWERSHELL
  6. Replace the boot.wim and install.wim files in the templates with files from the C:\win_update\win_templates\2012\, C:\win_update\win_templates\2016\, C:\win_update\win_templates\2019 directories.