not windows-runtime (PowerShell) Why does this error and is there a better way to get same results?

Steven E 1 Reputation point
2020-05-15T07:10:25.227+00:00

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

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,700 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Fay Wang - MSFT 5,216 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.

    0 comments No comments

  2. Steven Ellet 1 Reputation point
    2020-05-26T03:43:22.867+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.