Il nous arrive parfois dans SCCM de vouloir créer une nouvelle image de démarrage et de vouloir y inclue les mêmes pilotes qu’une autre image de démarrage.
Et bien voici un script qui le fera pour vous :
Param( [Parameter(Mandatory=$false)][switch]$updateDP, [Parameter(Mandatory=$true)]$SiteCode, [Parameter(Mandatory=$true)]$SourceWinPEID, [Parameter(Mandatory=$true)]$TargetWinPEID ) Import-Module ((Split-Path -Path $env:SMS_ADMIN_UI_PATH -Parent) + '\ConfigurationManager.psd1')</div> Set-Location $SiteCode":" try { $SourcePE = Get-CMBootImage -Id $SourceWinPEID if ($SourcePE -eq $null) { Write-Host "Cannot find source WinPe, make sure you entered the correct Id" -ForegroundColor red exit } Write-Host "Source WinPe " $SourcePE.Name } catch { Write-Host "Cannot find source WinPe, make sure you entered the correct Id" -ForegroundColor red Write-Error $_ exit } try { $TargetPE = Get-CMBootImage -Id $TargetWinPEID if ($TargetPE -eq $null) { Write-Host "Cannot find target WinPe, make sure you entered the correct Id" -ForegroundColor red exit } Write-Host "Target WinPe " $TargetPE.Name } catch { Write-Host "Cannot find target WinPe, make sure you entered the correct Id" -ForegroundColor red Write-Error $_ exit } $SourcePEDrivers = $SourcePE.ReferencedDrivers foreach ($Driver in $SourcePEDrivers) { $cmDriver = Get-CMDriver -Id $Driver.Id Write-Host "Copying " $cmDriver.LocalizedDisplayName " " $cmDriver.DriverVersion "... " -NoNewline try { Set-CMDriver -Id $cmDriver.CI_ID -AddBootImagePackage $TargetPE -UpdateDistributionPointsforBootImagePackage $false -Force -WarningAction SilentlyContinue Write-Host "OK" -ForegroundColor Green } catch { Write-Host "KO" -ForegroundColor red Write-Error $_ } }
Une réflexion sur “[SCCM] Copier les pilotes d’une image de démarrage vers une autre”