Thread closed. Go to
not windows-runtime (PowerShell) Why does this error and is there a better way to get same results?
$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 $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() $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 } $updateSvc.Services | ? { $.IsDefaultAUService -eq $false -and $.ServiceID -eq "7971f918-a847-4430-9279-4a52d1efe18d" } | % { $UpdateSvc.RemoveService($.ServiceID) } https://superuser.com/questions/1243011/how-to-automatically-update-all-devices-in-device-manager
Results
Searching Driver-Updates...
Downloading Drivers...
Exception from HRESULT: 0x80240024
At line:21 char:1
- $Downloader.Download()
- ~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : OperationStopped: (:) [], COMException
- FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Installing Drivers...
Exception from HRESULT: 0x80240024
At line:28 char:1
- $InstallationResult = $Installer.Install()
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : OperationStopped: (:) [], COMException
- FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Done..
2 answers
Sort by: Newest
-
-
Fay Wang - MSFT 5,196 Reputation points
2020-05-18T09:49:46.73+00:00 Hello,
Welcome to Microsoft Q&A!
Currently, all the supported topics are on the right top. Not all topics are supported in Microsoft Q&A.
Your question about power shell is not supported, you can go to this forum to ask it.
Thanks.