可能重复:
检测Windows是否有Windows更新准备下载的最佳方式/安装?
我使用C#.NET 3.5。
我怎么能知道是否有更新,准备安装在Windows更新?
在Windows 8,当Windows更新正在等待安装更新,睡眠选项被禁用。
而不是常规3种选择:1.睡眠2.重新启动3.关机,只有2种选择:1,重新启动并更新2.关闭和更新。 我需要确定这种状态,并通知监守更新正在等待要安装的机器不能移动到睡眠模式用户。
我能做到这一点使用WUAPILib?
谢谢
可能重复:
检测Windows是否有Windows更新准备下载的最佳方式/安装?
我使用C#.NET 3.5。
我怎么能知道是否有更新,准备安装在Windows更新?
在Windows 8,当Windows更新正在等待安装更新,睡眠选项被禁用。
而不是常规3种选择:1.睡眠2.重新启动3.关机,只有2种选择:1,重新启动并更新2.关闭和更新。 我需要确定这种状态,并通知监守更新正在等待要安装的机器不能移动到睡眠模式用户。
我能做到这一点使用WUAPILib?
谢谢
您可以使用WUApiLib(比较LIB)本:
var updateSession = new UpdateSession();
var updateSearcher = updateSession.CreateUpdateSearcher();
updateSearcher.Online = false; //set to true if you want to search online
try
{
var searchResult = updateSearcher.Search("IsInstalled=0 And IsHidden=0");
if (searchResult.Updates.Count > 0)
{
MessageBox.Show("There are updates available for installation");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"Error");
}
点击这里 ,如果你想知道更多。