L2T

| BLOG IT |

L2T

| BLOG IT |

Parfois, il peut arriver de vouloir récupérer les drivers insérés dans une image de démarrage pour les mettre dans une autre. Vous pouvez pour cela les lister via une commande DSIM et ensuite les intégrer dans la nouvelle. Mais Mickael PONSOT’S nous propose de passer via un simple script PowerShell.

Voici son script

[pastacode lang= »bash » manual= »Param(%0A%5BParameter(Mandatory%3D%24false)%5D%5Bswitch%5D%24updateDP%2C%0A%5BParameter(Mandatory%3D%24true)%5D%24SiteCode%2C%0A%5BParameter(Mandatory%3D%24true)%5D%24SourceWinPEID%2C%0A%5BParameter(Mandatory%3D%24true)%5D%24TargetWinPEID%0A)%0A%20%0AImport-Module%20((Split-Path%20-Path%20%24env%3ASMS_ADMIN_UI_PATH%20-Parent)%20%2B%20’%5CConfigurationManager.psd1′)%3C%2Fdiv%3E%0A%20%0ASet-Location%20%24SiteCode%22%3A%22%0A%20%0Atry%0A%7B%0A%24SourcePE%20%3D%20Get-CMBootImage%20-Id%20%24SourceWinPEID%0Aif%20(%24SourcePE%20-eq%20%24null)%0A%7B%0AWrite-Host%20%22Cannot%20find%20source%20WinPe%2C%20make%20sure%20you%20entered%20the%20correct%20Id%22%20-ForegroundColor%20red%0Aexit%0A%7D%0AWrite-Host%20%22Source%20WinPe%20%22%20%24SourcePE.Name%0A%7D%0Acatch%0A%7B%0AWrite-Host%20%22Cannot%20find%20source%20WinPe%2C%20make%20sure%20you%20entered%20the%20correct%20Id%22%20-ForegroundColor%20red%0AWrite-Error%20%24_%0Aexit%0A%7D%0Atry%0A%7B%0A%24TargetPE%20%3D%20Get-CMBootImage%20-Id%20%24TargetWinPEID%0Aif%20(%24TargetPE%20-eq%20%24null)%0A%7B%0AWrite-Host%20%22Cannot%20find%20target%20WinPe%2C%20make%20sure%20you%20entered%20the%20correct%20Id%22%20-ForegroundColor%20red%0Aexit%0A%7D%0AWrite-Host%20%22Target%20WinPe%20%22%20%24TargetPE.Name%0A%7D%0Acatch%0A%7B%0AWrite-Host%20%22Cannot%20find%20target%20WinPe%2C%20make%20sure%20you%20entered%20the%20correct%20Id%22%20-ForegroundColor%20red%0AWrite-Error%20%24_%0Aexit%0A%7D%0A%20%0A%24SourcePEDrivers%20%3D%20%24SourcePE.ReferencedDrivers%0Aforeach%20(%24Driver%20in%20%24SourcePEDrivers)%0A%7B%0A%24cmDriver%20%3D%20Get-CMDriver%20-Id%20%24Driver.Id%0AWrite-Host%20%22Copying%20%22%20%24cmDriver.LocalizedDisplayName%20%22%20%22%20%24cmDriver.DriverVersion%20%22…%20%22%20-NoNewline%0Atry%0A%7B%0ASet-CMDriver%20-Id%20%24cmDriver.CI_ID%20-AddBootImagePackage%20%24TargetPE%20-UpdateDistributionPointsforBootImagePackage%20%24false%20-Force%20-WarningAction%20SilentlyContinue%0AWrite-Host%20%22OK%22%20-ForegroundColor%20Green%0A%7D%0Acatch%0A%7B%0AWrite-Host%20%22KO%22%20-ForegroundColor%20red%0AWrite-Error%20%24_%0A%7D%0A%7D%0A » message= » » highlight= » » provider= »manual »/]

  • Et pour lire son article : ICI