Exportera / Importera Boot-image drivrutiner till ny Boot-image

Återigen, ett mycket bra PowerShell-script som besparar massa tid.

Function Export-BootImageDrivers {
    PARAM (
        [String] $ImageId,
        [String] $ExportXml
    )
  
    $drivers = @{}
    (Get-CMBootImage -Id $ImageId).ReferencedDrivers | ForEach-Object {
        Write-Verbose "Found driver ID - $($_.Id)"
 
        $drivers.Add($_.Id, $_.SourcePath)
    }
 
    $drivers | Export-Clixml -Path $ExportXml
}
 
Function Import-BootImageDrivers {
    PARAM (
        [String] $ImageId,
        [String] $ExportXml
    )
 
    $BootImage = Get-CMBootImage -Id $ImageId
    $drivers = Import-Clixml -Path $ExportXml
    $drivers.GetEnumerator() | ForEach-Object {
        Write-Verbose "Adding driver ID - $($_.Name)"
        Set-CMDriver -Id $_.Name -AddBootImagePackage $BootImage -UpdateDistributionPointsforBootImagePackage $false -Force
    }
}

Exportera först drivrutinerna

Export-BootImageDrivers -ImageId “ABC00123” -ExportXml “D:\Script\PS\drivers.xml”

Uppgradera Boot-imagen

Sedan importera drivrutinerna

Import-BootImageDrivers -ImageId “ABC00345” -ExportXml “D:\Script\PS\drivers.xml”

Tack till Rikard Rönnkvist, källa: SnowLand