Windows 10 Update APIs

This section provides comprehensive documentation for the Windows Update APIs, allowing developers to programmatically manage and interact with the Windows Update service on Windows 10 devices.

Overview

The Windows Update APIs enable scenarios such as:

Key Concepts

Understanding these concepts is crucial for effective use of the Windows Update APIs:

API Reference Categories

Update Session Management

CreateUpdateSession

Creates a new update session object.

Signature:

HRESULT CreateUpdateSession(
  [out] IUpdateSession **ppUpdateSession
);

Parameters:

ppUpdateSession
A pointer to an IUpdateSession interface pointer that receives the newly created session object.

Remarks: This is the starting point for most Windows Update operations.

UpdateSession.Query

Queries for available updates based on specified criteria.

Signature:

HRESULT Query(
  [in]  IInstallationCriteria *pCriteria,
  [out] IUpdateCollection **ppUpdates
);

Parameters:

pCriteria
An IInstallationCriteria object that specifies the search criteria.
ppUpdates
A pointer to an IUpdateCollection interface pointer that receives a collection of found updates.

Update Installation

CreateUpdateInstaller

Creates an update installer object.

Signature:

HRESULT CreateUpdateInstaller(
  [out] IUpdateInstaller **ppUpdateInstaller
);

Parameters:

ppUpdateInstaller
A pointer to an IUpdateInstaller interface pointer.

UpdateInstaller.Install

Installs the specified updates.

Signature:

HRESULT Install(
  [in]  IUpdateCollection *pUpdatesToInstall,
  [out] IOperationProgress **ppOperationProgress
);

Parameters:

pUpdatesToInstall
An IUpdateCollection containing the updates to install.
ppOperationProgress
A pointer to an IOperationProgress interface pointer to track the installation progress.

Note: Ensure you have the necessary permissions to install updates.

Update Status and History

UpdateSession.GetUpdateHistory

Retrieves the history of update operations.

Signature:

HRESULT GetUpdateHistory(
  [out] IUpdateHistoryCollection **ppHistory
);

Parameters:

ppHistory
A pointer to an IUpdateHistoryCollection interface pointer.

Best Practices

Warning: Incorrectly using the Windows Update APIs can lead to system instability or data loss. Always test your implementation thoroughly.