question

StevenE-4879 avatar image
0 Votes"
StevenE-4879 asked ·

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

not-supported
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FayWang-MSFT avatar image
0 Votes"
FayWang-MSFT answered ·

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.


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

StevenEllet-6923 avatar image
0 Votes"
StevenEllet-6923 answered ·
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.