Integrating Virtio and Areace drivers in Windows Server 2012/2016 Image

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034

# Create a temporary folder with these subfolders:
# – iso : Contents of extracted ISO file
# – mnt : Empty folder to mount WIM files
# – drv : Folder containing the drivers to
inject

$Path = “C:\tmp”
$DismLogFile = “$Path\Dism.log”
# Remaster ISO parameters
$OScdImg = “C:\Program Files (x86)\Windows
Kits\8.1\Assessment and Deployment Kit\Deployment
Tools\amd64\Oscdimg\Oscdimg.exe”

$ISOLabel = “Win2016Prv2_unattend”
$ISOPath = “\\10.1.0.3\Data\$ISOLabel.iso”
# Inject driver in either/or install.wim,
boot.wim or both

$wims = “install.wim”,“boot.wim”
foreach ($wim in $wims) {
    $images = Get-WindowsImage -ImagePath “$Path\iso\sources\$wim”
    foreach($image in $images) {
         $image
         Mount-WindowsImage -Path “$Path\mnt” -ImagePath “$Path\iso\sources\$wim” -Index $Image.ImageIndex -LogPath $DismLogFile
         Add-WindowsDriver -Path “$Path\mnt” -Driver “$Path\drv” -Recurse | _
            Select-Object Driver,CatalogFile,ProviderName,Version,Date,DriverSignature | _
            Format-Table -autosize
         Dismount-WindowsImage -Path “$Path\mnt” -Save  -LogPath $DismLogFile   #-CheckIntegrity
     }
}
# Remaster the ISO
If (Test-Path $oscdimg) {
    & $oscdimg -h -u2 -m -l”$isolabel” -b”$Path\iso\boot\etfsboot.com” “$Path\iso” “$ISOPath”
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.