Jan,
I have come across the problem still. I tried using the Add-WindowsUpdate function and still getting the error.
I'm trying to see if there is an issue with Windows Updates itself then try and run the updates again.
I've also tried invoking the commands and still get the same error, also use the -cred parameter, doesn't seem to change it. I can do it on my local machine with no problems, and I'm sure if I ran it on the remote machine locally it would work fine.
in the Link that was given, i tried using the Add-windowsupdate function
Function Add-WindowsUpdate
{ param ($Criteria="IsInstalled=0 and Type='Software'" , [switch]$AutoRestart, [Switch]$ShutdownAfterUpdate)
$resultcode= @{0="Not Started"; 1="In Progress"; 2="Succeeded"; 3="Succeeded With Errors"; 4="Failed" ; 5="Aborted" }
$updateSession = new-object -com "Microsoft.Update.Session"
write-progress -Activity "Updating" -Status "Checking available updates"
$updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates
if ($Updates.Count -eq 0) { "There are no applicable updates."}
else {
$downloader = $updateSession.CreateUpdateDownloader()
$downloader.Updates = $Updates
write-progress -Activity 'Updating' -Status "Downloading $($downloader.Updates.count) updates"
$Result= $downloader.Download()
if (($Result.Hresult -eq 0) –and (($result.resultCode –eq 2) -or ($result.resultCode –eq 3)) ) {
$updatesToInstall = New-object -com "Microsoft.Update.UpdateColl"
$Updates | where {$_.isdownloaded} | foreach-Object {$updatesToInstall.Add($_) | out-null }
$installer = $updateSession.CreateUpdateInstaller()
$installer.Updates = $updatesToInstall
write-progress -Activity 'Updating' -Status "Installing $($Installer.Updates.count) updates"
$installationResult = $installer.Install()
$Global:counter=-1
$installer.updates | Format-Table -autosize -property Title,EulaAccepted,@{label='Result';expression={$ResultCode[$installationResult.GetUpdateResult($Global:Counter++).resultCode ] }}
if ($autoRestart -and $installationResult.rebootRequired) { Write-Host "A Reboot Is required for updates to take effect" }
if ($ShutdownAfterUpdate) { Write-Host "A Reboot is required for Updates to take effect" } } }
}
I went down the function and the problem seems to start at
$downloader = $updateSession.CreateUpdateDownloader()
Then just stops from there