의 정확하고 지역화 목록 나는 C# .NET을 사용하여 컴퓨터에 설치된 Windows 업데이트의 정확한 및 지역화 목록을 조회 할 수 있습니까?쿼리 설치된 Windows 업데이트
나는 WUApi.DLL를 사용하는 경우 7.
, 정보는 Windows에서 프로그램 및 기능에서 마이크로 소프트의보기 설치된 업데이트 대화 상자의 "마이크로 소프트 윈도우"카테고리에 표시되는 내용을 일치로 정확한을 정의 현지화되었지만 정확한 목록을 가져올 수 없습니다. WUApi.dll의 경우, 일부 핫픽스가 누락 및 업데이트가 제거 된 경우, 여전히 다음 코드에 의해 생성 된 목록에 표시하십시오 WUApi 검색 방법도 제공하지 않았다
public static void GetWindowsUpdates()
{
var updateSession = new UpdateSession();
var updateSearcher = updateSession.CreateUpdateSearcher();
var count = updateSearcher.GetTotalHistoryCount();
if (count == 0)
return;
var history = updateSearcher.QueryHistory(0, count);
for (int i = 0; i < count; i++)
{
if (history[i].ResultCode == OperationResultCode.orcSucceeded)
{
Console.WriteLine(history[i].Title);
if (history[i].Operation == UpdateOperation.uoUninstallation)
{
Console.WriteLine("!!! Operation == uninstall"); // This is never true
}
}
}
}
다음 코드를 사용하여 정확한 목록은 : 나는 업데이트 목록을 읽을 수 WMI를 사용하는 경우
WUApiLib.UpdateSessionClass session = new WUApiLib.UpdateSessionClass();
WUApiLib.IUpdateSearcher searcher = session.CreateUpdateSearcher();
searcher.IncludePotentiallySupersededUpdates = true;
WUApiLib.ISearchResult result = searcher.Search("IsInstalled=1");
Console.WriteLine("Updates found: " + result.Updates.Count);
foreach (IUpdate item in result.Updates)
{
Console.WriteLine(item.Title);
}
, 나는 정확한 목록을 얻을 수 있지만 지역화되지 않습니다. 나는 다음과 같은 코드를 사용합니다
이ManagementObjectSearcher searcher = new ManagementObjectSearcher(new ObjectQuery("select * from Win32_QuickFixEngineering"));
searcher.Options.UseAmendedQualifiers = true;
searcher.Scope.Options.Locale = "MS_" + CultureInfo.CurrentCulture.LCID.ToString("X");
ManagementObjectCollection results = searcher.Get();
Console.WriteLine("\n==WMI==" + results.Count);
foreach (ManagementObject item in results)
{
Console.WriteLine("\t--Properties--");
foreach (var x in item.Properties)
{
Console.WriteLine(x.Name + ": " + item[x.Name]);
}
Console.WriteLine("\t--System Properties--");
foreach (var x in item.SystemProperties)
{
Console.WriteLine(x.Name + ": " + x.Value);
}
Console.WriteLine("\t--Qualifiers--");
foreach (var x in item.Qualifiers)
{
Console.WriteLine(x.Name + ": " + x.Value);
}
}
모든 업데이트를하는 동안 우리는 같은 문제에 직면하고있다. 어떻게이 문제를 해결 했습니까? 가능하다면 코드를 공유 할 수 있습니까? –
는 "WUApi 만 WUApi을 통해 완성 된 작업을 등록"에 대한 MSDN의 모든 문서가 있습니까? –