正在从本地服务器下载更新,而不是从WUS或Microsoft存储库下载更新。本地服务器是基于Linux的,哪个主机是每个更新的内容。WUApiLib IUpdateInstaller2产生错误;某些操作系统更新安装了其他操作系统-2145124318
我没有使用UpdateDownloader
从Microsoft Servers下载,我手动下载更新内容,然后使用CopyToCache
。
这些安装罚款
安全更新的Microsoft .NET Framework 3.5 SP1的Windows XP,Server 2003中,Vista中,Server 2008中的x86(KB2736416)
安全更新微软的Visual Studio 2010(KB2542054 )
这些并没有
硒安全更新对XP的Microsoft .NET Framework 4,Server 2003中, Vista中,Windows 7,Server 2008中的x86(KB2840628)
更新适用于Windows XP的Microsoft .NET Framework 3.5 SP1,服务器2003,Vista和Server 2008年86(KB2836940)
我的过程是如何工作的
我收到这个从我用它来下载更新的所有下载内容的本地服务器的安装。 (以上KB2840628的块引用文本下面提供的示例)
{
"app_uris": [
{
"file_name": "msipatchregfix-x86_94a84b80b8b45a1ac53a0e5d085513da0f099655.exe",
"file_uri": "https://192.168.5.108/packages/d13c13c81f94fbb48f39c817a71ff239a31773d3a0e821a968dc42a913892841/msipatchregfix-x86_94a84b80b8b45a1ac53a0e5d085513da0f099655.exe",
"file_size": 130600
},
{
"file_name": "ndp40-kb2840628-v2-x86_891d50ff3c1322db3fb0fde222ebb0aaa5260272.exe",
"file_uri": "https://192.168.5.108/packages/d13c13c81f94fbb48f39c817a71ff239a31773d3a0e821a968dc42a913892841/ndp40-kb2840628-v2-x86_891d50ff3c1322db3fb0fde222ebb0aaa5260272.exe",
"file_size": 13294216
}
],
"app_id": "d13c13c81f94fbb48f39c817a71ff239a31773d3a0e821a968dc42a913892841",
"app_name": "Security Update for Microsoft .NET Framework 4 on XP, Server 2003, Vista, Windows 7, Server 2008 x86 (KB2840628)"
}
随着中说,问题是,某些更新安装完全正常,但某些更新(我认为有一个以上的bundle-updates
的那些)别不要穿过它,它让我发疯!
我首先下载每个Uri
,然后将它们加载到CopyToCache
的更新中。
var collection = new UpdateCollection();
IList<string> updateFiles = Directory.GetFiles(updateFolder);
var fileCollection = new StringCollection();
try
{
foreach (var file in updateFiles)
fileCollection.Add(file);
//Error happens here on certain updates. Not all.
((IUpdate2)update.BundledUpdates[0]).CopyToCache(fileCollection);
collection.Add(update);
return collection;
}
catch (Exception e)
{
return null;
}
在此之后,返回的集合是通过我的WindowsUpdateInstaller
方法通过如下图所示:
IUpdateSession Session = new UpdateSession();
var updatesToInstall = //THIS GETS THE RETURN FROM THE ABOVE CODE...
var installer = (IUpdateInstaller2)Session.CreateUpdateInstaller();
installer.ForceQuiet = true;
installer.AllowSourcePrompts = false;
installer.Updates = updatesToInstall;
foreach (IUpdate updateNode in installer.Updates)
{
updateNode.AcceptEula();
}
//FAILS HERE WITH "-2145124318, Result code: orcFailed",
var installationRes = installer.Install();
var installResult = installationRes.GetUpdateResult(0);
的更新安装就好了,如果我在执行其手动双击并手动安装,而不使用码。
是一个互动的环境中运行你的代码?通常这些事情都会留下相当详细的日志,而不仅仅是一个'-2145124318'的返回码。此外,Google的一个快速版本[this](http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_update/windows-update-will-not-work-getting-error/500d9cbb-d394- 4f3b-ac32-88ad46414d2a)这可能表明更新无法连接到互联网?无论是因为BITS,代理设置还是其他原因。 –
@ ta.speot.is http://paste.ofcode.org/tzXzURmFHvLRNpYFpiekFG我在VS2010中以调试模式运行它。我已经在XP和Windows 7上测试过了。文件通过“CopyToCache”被推送到'IUpdate',我无法从Microsoft服务器获取'WUapi'。另外,我有AU禁用。 – Dayan
那么失败的更新似乎与Windows Defender有关。请参阅http://support.microsoft.com/kb/918355,其中引用0x80240022。它说,尝试使用方法2来安装更新,基本上“这太难了,手动安装”。有一个错误提示[在这里](http://www.hanselman.com/blog/WindowsDefenderErrors0x8024402c0x80240022And1609.aspx),但不是不太可能,说明已过时... –