Hi,
Please ask on our sister site Technet which can handle WSUS questions better.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I am trying to run a powershell script on a Windows Server 2016 to find, download and install updates, but I get the following error:
Exception from HRESULT: 0x80240438
...
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Here is my script:
Write-Host "Installing WSUS-Updates"
$updateSession = New-Object -Comobject Microsoft.Update.Session
$updateSearcher = $updateSession.CreateUpdateSearcher()
$result = $updateSearcher.Search("IsInstalled=0 and Type='Software'")
if ($result.Updates.Count -eq 0){
Write-Host "No available updates"
exit
}
$updatesToDownload = New-Object -Comobject Microsoft.Update.UpdateColl
foreach ($update in $result.Updates){
$updatesToDownload.Add($update)
}
$downloader = $updateSession.CreateUpdateDownloader()
$downloader.Updates = $updatesToDownload
$downloadResult = $downloader.Download()
$updatesToInstall = New-Object -Comobject Microsoft.Update.UpdateColl
foreach ($update in $result.Updates){
if ($update.IsDownloaded) {$updatesToInstall.Add($update)}
}
$installer = $updateSession.CreateUpdateInstaller()
$installer.Updates = $updatesToInstall
$installationResult = $installer.Install()
exit
I tried running it with admin privileges also, but did not help.
WUServer and WUStatusServer register keys are set to the same path (I read that this may be the problem..)
What could possibly cause the issue?
Thank you in advance!!
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi,
Please ask on our sister site Technet which can handle WSUS questions better.