I pull all pending updates with this c# code:
using WUApiLib;
var updateSession = new UpdateSession();
var updateSearcher = updateSession.CreateUpdateSearcher();
updateSearcher.Online = false;
var searchResult = updateSearcher.Search("IsInstalled=0 And IsHidden=0");
if (searchResult.Updates.Count > 0)
{
foreach (IUpdate windowsUpdate in searchResult.Updates)
{
PendingUpdate update = new PendingUpdate();
update.Title = windowsUpdate.Title;
update.Description = windowsUpdate.Description;
update.Downloaded = windowsUpdate.IsDownloaded;
update.Urls = new List<string>();
foreach (string url in windowsUpdate.MoreInfoUrls)
{
update.Urls.Add(url);
}
foreach (dynamic category in windowsUpdate.Categories)
{
update.Categories += category.Name + ", ";
}
pendingUpdates.Add(update);
}
}
With this I get the pending windows updates I want but I also get updates, that I can't be found with "Search for windows updates" or even in the optional windows updates tab.
I don't want to install the updates, I just dont wan't the updates saved in my code if they cant be installed with the regular update functions of windows.
The two updates are "SQL Server 2014 Service Pack 3 (KB4022619)" and "Microsoft Silverlight (KB4481252)".
Can I somehow don't search for updates that can't be find over the windows update center?