Exporter les drivers et importer les drivers en Powershell
On peut avoir besoin d’exporter les pilotes. Dans le cas d’un backup par exemple. Et on peut avoir besoin d’importer les pilotes. Dans le cas d’une réinstallation, par exemple.
Dans une fenêtre Windows PowerShell avec élévation de privilèges.
On saisit cette commande :
Export-WindowsDriver -Online -Destination D:\DriversBackup
Voir… Export-WindowsDriver https://docs.microsoft.com/en-us/powershell/module/dism/export-windowsdriver?view=win10-ps
Get-ChildItem "D:\DriversBackup\" -Recurse -Filter "*.inf" | ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }
Get-ChildItem
récupère tous les fichiers avec une extension « .inf » dans le répertoire et ses sous-répertoires D:\DriversBackup\
ForEach-Object
boucle sur ceux-ci et exécute les commandes du bloc de script
PNPUtil.exe
est un utilitaire CLI pour la gestion du magasin de pilotes Windows. L’argument /add-driver
ajoute le pilote spécifié au magasin de pilotes. /install
installe le pilote, en résolvant tous les problèmes de pilote manquants pour tout matériel connecté que le pilote convient.
Vous pouvez aussi utiliser Add-WindowsDriver
PS C:\WINDOWS\system32> get-help add-windowsDriver NOM Add-WindowsDriver RÉSUMÉ Adds a driver to an offline Windows image. SYNTAXE Add-WindowsDriver [-AdvancedDriverObject ] [-BasicDriverObject ] [-Driver ] [-ForceUnsigned] [-LogLevel {Errors | Warnings | WarningsInfo}] [-LogPath ] [-Recurse] [-ScratchDirectory ] [-SystemDrive ] [-WindowsDirectory ] -Path [] DESCRIPTION The Add-WindowsDriver cmdlet adds third-party driver packages to an offline Windows image. Use the Path parameter to specify the location of a mounted Windows image. Use the Driver parameter to specify the location of an .inf driver file or a folder containing one or more .inf driver files. Use the ForceUnsigned parameter to add unsigned .inf files to an x64-based image. LIENS CONNEXES Online Version: http://go.microsoft.com/fwlink/p/?linkid=289348 Get-WindowsDriver Remove-WindowsDriver REMARQUES Pour consulter les exemples, tapez : "get-help Add-WindowsDriver -examples". Pour plus d'informations, tapez : "get-help Add-WindowsDriver -detailed". Pour obtenir des informations techniques, tapez : "get-help Add-WindowsDriver -full". Pour l’aide en ligne, tapez : "get-help Add-WindowsDriver -online" PS C:\WINDOWS\system32>