IUpdateCollectionからまとめて実行するのが主流かと思いますが1つずつ実行したかったので作ってみました。
ダウンロードかインストールに失敗するとコンソール出力してfalseを返します。
using WUApiLib;
--(中略)--
public bool installUpdate(UpdateSession us, IUpdate5 update)
{
long success = 0x0;
IUpdateDownloader downloader = us.CreateUpdateDownloader();
downloader.Updates = new UpdateCollection();
downloader.Updates.Add(update);
IDownloadResult dr = downloader.Download();
if (dr.HResult != success)
{
Console.WriteLine("Failed to download : " + update.Title);
return false;
}
IUpdateInstaller installer = us.CreateUpdateInstaller();
installer.Updates = new UpdateCollection();
installer.Updates.Add(update);
IInstallationResult ir = installer.Install();
if (ir.HResult != success)
{
Console.WriteLine("Failed to install : " + update.Title);
return false;
}
return true;
}


