Skip to content

Instantly share code, notes, and snippets.

@ojmarcelino
Last active February 13, 2023 20:11
Show Gist options
  • Save ojmarcelino/0ac823adcd9820eddc2f43ef02176684 to your computer and use it in GitHub Desktop.
Save ojmarcelino/0ac823adcd9820eddc2f43ef02176684 to your computer and use it in GitHub Desktop.
Updates drivers on Windows devices
$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'"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment