Powershell обновление драйверов windows

Как в Windows 10 установить все драйвера при переустановке ОС.

Сегодня мы рассмотрим ситуацию, когда нам нужно переустановить на  ПК Windows 10, но при этом не хочется потом искать драйвера на все устройства по интернету или пользоваться дополнительными сборками драйверов. Хочется просто вытащить из ОС все драйвера а потом обратно всё установить т.е. сделать как было. Благо Windows 10 это позволяет.

Итак экспорт драйверов.

Открываем PowerShell

В окне пишем следующее:

Export-WindowsDriver -Online -Destination C:\BK

Внимание! Укажите правильную папку куда нужно выгрузить все драйвера, например на NAS или USB, D:\ и т.д.

В итоге мы получим через минуты 1.5 — 2 следующий вид

Далее переустанавливаем систему как нам удобно.

После всех переустановок запускаем в новой ОС Windows — PowerShell и пишем следующее

Get-ChildItem "C:\BK" -Recurse -Filter "*.inf" | ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }

Внимание! Укажите правильный пусть т.е. в место «C:\BK» то место куда вы сохранили все драйвера.

Осталось только дождаться установки всех драйверов и перезагрузиться по завершению.

Итоговый листинг

===========Export drivers==========
Export-WindowsDriver -Online -Destination C:\BK

-------------OR------------

$drivers = Export-WindowsDriver -Online -Destination C:\BK
$drivers | ft ProviderName, ClassName, Date, Version -auto

============Import drivers==========
Get-ChildItem "C:\BK" -Recurse -Filter "*.inf" | ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }

Удачи.



Update-Drivers-Win10-Powershell

Powershell Script to Update Drivers in Windows 10

Base for this project was script from StackExchange. The problem was it works only on Windows 7.
I thought it would be easy to adjust but it turns out it requires a lot of testing.

So after testing and experimenting I get this script.

Edit: New update!

Log feature added to script and fix for problem with some errors.
I added also timers.

This script:

  1. Starts with checking if terminal is runing with administrator priviledge.
    If it is not it propmts notification about requirement.

  2. Install and Import Windows Powershell Update Module

  3. Add ServiceID for Windows Update

  4. Start Service wuauserv

  5. Search and list all missing Drivers

  6. Download the Drivers from Microsoft

  7. Check if the Drivers are all downloaded and trigger the Installation

  8. Pause and give the service time to update

  9. Stop Windows Update Service

Roadmap / Plans

  1. Next stage is to add logging feature to be able to see all details about preupdate and post update drivers. [✔]
  2. Another feature I would like to add is measurements to count time spent on downloading and installing. [✔]
  3. I think also it would be nice to have good error hadling [partialy done]

References:

[1] https://superuser.com/questions/1243011/how-to-automatically-update-all-devices-in-device-manager

[2] https://rzander.azurewebsites.net/script-to-install-or-update-drivers-directly-from-microsoft-catalog/

[3] https://www.tenforums.com/tutorials/76207-update-upgrade-windows-10-using-powershell.html

Install Windows Drivers from a Folder Using PowerShell

Written on September 20, 2017

When building any computer, virtual or physical, it requires drivers. This script will allow you to place a folder of .inf (and associated) files onto a computer and then install all relevant drivers. This script is tested as working on Windows Server 2016 and Windows Server 2016 Core.

Get-ChildItem "C:\mydrivers\" -Recurse -Filter "*.inf" | 
ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }

How does it work?

The script is very simple:

  1. Get-ChildItem retrieves any files with a .inf extension in the C:\mydrivers\ directory and its subfolders
  2. ForEach-Object loops over these and performs the commands in the script block { } against them
  3. PNPUtil.exe is a CLI utility for management of the Windows driver store. The /add-driver argument adds the specified driver to the driver store. /install installs the driver, resolving any missing driver issues for any attached hardware the driver suits

Comments/questions

There’s no commenting functionality here. If you’d like to comment, please either mention me (@[email protected]) on Mastodon or email me. I don’t have any logging or analytics running on this website, so if you found something useful or interesting it would mean a lot to hear from you.

Installing drivers for windows is very time consuming when the driver package contain multiple devices/models files with all possible platform architecture(x86, x64, etc.).

We can leverage the pnputil.exe tool to perform the installation fast and easy.

Consider a scenario of a multiple drivers packed to an iso image. Below script will install all the required drivers.

# Mount the driver iso image
Mount-DiskImage D:\Driver\drivers-windows.iso

# Get the mount point/drive letter, considering that the above one is the only disk mounted
$isoMount = (Get-DiskImage -DevicePath \\.\CDROM0  | Get-Volume).DriveLetter

# Find the inf files and install
Get-ChildItem "$($isoMount):\" -Recurse -Include *.inf | ForEach-Object {
     $_.FullName
     pnputil /add-driver $_.FullName /install 
}

Running the script would update all the drivers which are meant for your system hardware.

Hope you like this article and thank you for reading.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Asus k50ij драйвера windows 10 64 bit
  • Аналоги sketch для windows
  • Nights into dreams windows
  • Redis for windows msi
  • Самые лучшие программы для windows 7