Windows Update Agent API not working in windows 11

Danieldty-4045 1 Reputation point
2022-08-02T00:39:36.62+00:00

We use this API https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iautomaticupdates-get_settings to retrieve update settings in windows11, but this API will return null.

Below is the windows update status which looks good.
![226952-image.png][1]

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,626 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,683 questions
{count} votes

2 answers

Sort by: Most helpful
  1. S.Sengupta 18,696 Reputation points MVP
    2022-08-02T00:48:19.167+00:00

  2. Limitless Technology 39,646 Reputation points
    2022-08-03T07:07:34.473+00:00

    Hello,

    This may be related in changes in the COM interface between versions, similar to issues between XP-W7-W10. You need to call the DetectNow on your auc object

    For example:

        WUApiLib.IAutomaticUpdates2 auc = new WUApiLib.AutomaticUpdates();  
        auc.DetectNow(); // get the current values from the system.  
        Console.WriteLine(auc.Results.LastInstallationSuccessDate);  
        Console.WriteLine(auc.Results.LastSearchSuccessDate);  
    

    ----------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept as answer--


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.