How to Automatically update all devices in device manager

52,530

Solution 1

The article 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 I have 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.

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

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.

Another example on its use is found in the article PS Script to automate Windows and MS Updates.

Solution 2

An Application Windows Update MiniTool exists which can get those drivers, yet its capable of much more - regarding windows updates.

(I personally still prefer the script from harrymc, its painless - just start it and done)


Quoted from the English Forum:

Screenshot from the application

An alternative to the standard Windows Update
What you can do:

 - Check for updates
 - Download updates
 - Installing Updates
 - Deleting installed updates
 - Hiding unwanted updates
 - Get direct links to the *.cab / *.Exe / *.Psf update files
 - View update history
 - Configure Automatic Updates

Solution 3

Another tool to update, very similar to "Windows Update MiniTool":

https://github.com/DavidXanatos/wumgr

Download link: https://github.com/DavidXanatos/wumgr/releases/latest

Screenshot from the linked tool

Share:
52,530

Related videos on Youtube

user5542121
Author by

user5542121

BY DAY: Web Developer. BY NIGHT: I administrate communities, I code, I sleep FOR FUN: I code and watch youtube and read a lot Quote: I don't measure a man's success by how high he climbs but how high he bounces when he hits bottom ― George S. Patton Jr.

Updated on September 18, 2022

Comments

  • user5542121
    user5542121 over 1 year

    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).

    • Persistent13
      Persistent13 over 6 years
      Do you want driver updates in general or do you have specific hardware model in mind?
    • antzshrek
      antzshrek over 6 years
      Have you tried the devcon thing on the command prompt?
    • user5542121
      user5542121 over 6 years
      @Persistent13 updates in general, nothing specific
    • user5542121
      user5542121 over 6 years
      @Antz devcon seems perfect, at least the documentation says it can update. docs.microsoft.com/en-us/windows-hardware/drivers/devtest/… Will have to try, thx!
    • user5542121
      user5542121 over 6 years
      @Antz I tried devcon, as it seems it does not do a online lookup for the drivers. It can only install a given inf file.
    • user5542121
      user5542121 over 6 years
      seems like I will have to write a autoit script, something like this: blueworld.ca/2014/11/autoit-modify-com-port-properties
    • Darren
      Darren over 6 years
      Don’t any available driver updates appear in Windows update? I know they show as optional updates in Win 7, not sure how it works in 10.
    • user5542121
      user5542121 over 6 years
      As far as I can tell they do not appear. I am not sure if they are even listed as optional download in windows 7. You could try to manually update the devices in device manager, hard to tell if its same there.
    • user5542121
      user5542121 over 6 years
  • user5542121
    user5542121 over 6 years
    Beautiful! I extended the script a bit, as title #set Window Title $host.ui.RawUI.WindowTitle = "Driver Updater by harrymc" and to prevent the powershell from closing Write-Host Write-Host('Press any key to exit ...') -Fore Yellow $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") and to run the script from a a batch: @echo off powershell.exe -noprofile -ExecutionPolicy Unrestricted -command "&{start-process powershell -ArgumentList ' -ExecutionPolicy Unrestricted -noprofile -file ""%~dp0update.ps1""' -verb RunAs} while the ps script is named update.ps1 and is in same dir.
  • user5542121
    user5542121 over 6 years
    Ah sorry, only realized now I have to press the button to give the bounty, thought accepting the answer is enough.
  • harrymc
    harrymc over 6 years
    Thanks. Accepting the answer is enough, but the bounty is only awarded by the end of the 7 days posting-period.
  • JinSnow
    JinSnow about 5 years
    It did not work for me (Exception from HRESULT: 0x80240024)
  • harrymc
    harrymc about 5 years
    @JinSnow: It would be better to post a separate question with details about what you did.
  • Moab
    Moab over 4 years
    Looks like a rip off of software I found several years ago (2015), development has stopped and can no longer be found, he was a Russian, his last version was wumt_v30.07.2016>>>>>>>>>>>>>>wilderssecurity.com/threads/wi‌​ndows-update-minitoo‌​l.380535
  • Moab
    Moab over 4 years
    I still use this on W10, it stops auto updates which is the best feature.
  • user5542121
    user5542121 over 4 years
    It seems to me like a fork, not a rip. I found first the one u linked, and add as answer, later I found this one .. and seems more uptodate.
  • Moab
    Moab over 4 years
    My old version from 2015 seems to work just fine, but thanks for the link to the fork.
  • Jonas
    Jonas about 4 years
    It stops during "Searching driver-updates": Exception from HRESULT: 0x80248014 At line:12 char:1 + $SearchResult = $Searcher.Search($Criteria) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException Any ideas?
  • Dan Henderson
    Dan Henderson over 3 years
    @Jonas I had this error on a domain PC with WSUS server configured. To resolve, I added these lines (from the article linked in the answer), to add the Microsoft Catalog as an Update-Source at the top of the script: $UpdateSvc = New-Object -ComObject Microsoft.Update.ServiceManager $UpdateSvc.AddService2("7971f918-a847-4430-9279-4a52d1efe18d‌​",7,"") and at the bottom, to remove the Catalog again: $updateSvc.Services | ? { $_.IsDefaultAUService -eq $false -and $_.ServiceID -eq "7971f918-a847-4430-9279-4a52d1efe18d" } | % { $UpdateSvc.RemoveService($_.ServiceID) }
  • Dan Henderson
    Dan Henderson over 3 years
    @JinSnow this might also be what you needed.