Comment Automatically mise à jour all périphériques in périphérique manager

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment Automatically mise à jour all périphériques in périphérique manager

Message par ForumBot »

In Windows device manager it is possible to "manually" start an automatic update of a device. But its very tedious, each device has to be clicked (as it is not known if that particular device has an update available) - then the popups have to be clicked - and one has to wait for the online search to finish.

So I hoped there is some Powershell script being able to do this, or maybe a registry entry to have "Windows Update" taking care of that.

(Ehm yes, Windows does NOT automatically update ALL devices in device manager).
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment Automatically mise à jour all périphériques in périphérique manager

Message par ForumBot »

The article
[Script to install or update drivers directly from Microsoft Catalog](http://rzander.azurewebsites.net/script-to-install-or-update-drivers-directly-from-microsoft-catalog/)
contains a PowerShell script for doing what is asked.

The article includes good explanations of each part of the script.
I reproduce below just the bare script with only minor changes (which J'ai not tested):

```
#search and list all missing Drivers

$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()

$Searcher.ServiceID = '7971f918-a847-4430-9279-4a52d1efe18d'
$Searcher.SearchScope = 1 # MachineOnly
$Searcher.ServerSelection = 3 # Third Party

$Criteria = "IsInstalled=0 and Type='Driver' and ISHidden=0"
Write-Host('Searching Driver-Updates...') -Fore Green
$SearchResult = $Searcher.Search($Criteria)
$Updates = $SearchResult.Updates

#Show available Drivers

$Updates | select Title, DriverModel, DriverVerDate, Driverclass, DriverManufacturer | fl

#Download the Drivers from Microsoft

$UpdatesToDownload = New-Object -Com Microsoft.Update.UpdateColl
$updates | % { $UpdatesToDownload.Add($_) | out-null }
Write-Host('Downloading Drivers...') -Fore Green
$UpdateSession = New-Object -Com Microsoft.Update.Session
$Downloader = $UpdateSession.CreateUpdateDownloader()
$Downloader.Updates = $UpdatesToDownload
$Downloader.Download()

#Check if the Drivers are all downloaded and trigger the Installation

$UpdatesToInstall = New-Object -Com Microsoft.Update.UpdateColl
$updates | % { if($_.IsDownloaded) { $UpdatesToInstall.Add($_) | out-null } }

Write-Host('Installing Drivers...') -Fore Green
$Installer = $UpdateSession.CreateUpdateInstaller()
$Installer.Updates = $UpdatesToInstall
$InstallationResult = $Installer.Install()
if($InstallationResult.RebootRequired) {
Write-Host('Reboot required! please reboot now..') -Fore Red
} else { Write-Host('Done..') -Fore Green }

```

A general-purpose and powerful package is
[**PSWindowsUpdate**](https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc).

Here are a couple of tutorials on installing and using it :

- [Windows 10: Update and Upgrade Windows 10 using PowerShell](https://www.tenforums.com/tutorials/76207-update-upgrade-windows-10-using-powershell.html).

- [Managing Windows Updates with PowerShell](https://www.petri.com/manage-windows-updates-with-powershell-module)

The package adds the `Get-WUInstall` command (and others) with which you may
get and install updates.
The source of `Get-WUInstall` is also available separately
[from github](https://github.com/joeypiccola/PSWindowsUpdate/blob/master/Get-WUList.ps1).

Another example on its use is found in the article
[PS Script to automate Windows and MS Updates](https://community.spiceworks.com/topic/2001180-ps-script-to-automate-windows-and-ms-updates).
Répondre

Revenir à « Performance & Dépannage »