Loading
Bäcke's – backes.nu

Bäcke – Stockholm – Sweden

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

Kopiera drivrutiner från en boot-image till en annan

Lifesaver. Eller med andra ord, en grym tidsbesparare.

Function Copy-BootImageDrivers {
    PARAM (
        $from, $to
    )
 
    $boot = Get-CMBootImage -ID $to
 
    (Get-CMBootImage -Id $from).ReferencedDrivers | ForEach-Object {
        Write-Verbose "Copying $($_.Id) to $($to)"
        Set-CMDriver -Id $_.Id -AddBootImagePackage $boot -UpdateDistributionPointsforBootImagePackage $false
    }
 
}
 
#Example use
Copy-BootImageDrivers -from "ABC00123" -to "ABC00456"

Tack till Rikard Rönnkvist, källa SnowLand

By continuing to use this site, you agree to the use of cookies. more information

Your settings for this site is set to "allow cookies" to give you the best experience. If you continue to use the site without changing your settings for cookies, or if you click "Accept" below, you agree to this.

Stäng