Share via


Windows.Management.Update Namespace

The Windows.Management.Update namespace provides APIs for managing Windows Update operations across Windows devices. It serves two distinct purposes:

These API groups coexist in the same namespace but target different scenarios. Choose the correct set based on your device type and update requirements.

Classes

Name Description
PreviewBuildsManager

Manages the state of preview builds for the device.

PreviewBuildsState

Contains information used to connect a device to associate the device with the Windows Insider Program.

WindowsSoftwareUpdate
WindowsSoftwareUpdateActionInfo
WindowsSoftwareUpdateActionProgress
WindowsSoftwareUpdateActionResultInfo
WindowsSoftwareUpdateAppPackageInfo
WindowsSoftwareUpdateApprovalInfo
WindowsSoftwareUpdateExecutionInfo
WindowsSoftwareUpdateLocalizationInfo
WindowsSoftwareUpdateOptionalActionInfo
WindowsSoftwareUpdateOptionalInfo
WindowsSoftwareUpdateProvider
WindowsSoftwareUpdateProviderActionResult
WindowsSoftwareUpdateProviderPayloadFileInfo
WindowsSoftwareUpdateProviderStatus
WindowsSoftwareUpdateResult
WindowsSoftwareUpdateScanResult
WindowsSoftwareUpdateVersion
WindowsUpdate

WindowsUpdate is essentially a property bag with information about a pending or in-progress update.

WindowsUpdateActionCompletedEventArgs

Event data for the corresponding WindowsUpdateManager.ActionCompleted event.

WindowsUpdateActionProgress

Returned by the ActionProgress properties of WindowsUpdate and WindowsUpdateProgressChangedEventArgs.

WindowsUpdateActionResult

Returned by the WindowsUpdate.ActionResult property.

WindowsUpdateAdministrator

Enables administration of Windows Updates on a device.

WindowsUpdateApprovalData

Allows additional metadata to be configured on an update when approving it via ApproveWindowsUpdate.

WindowsUpdateAttentionRequiredInfo

Represents a tuple of a WindowsUpdateAttentionRequiredReason and a timestamp.

WindowsUpdateAttentionRequiredReasonChangedEventArgs

Event data for the corresponding WindowsUpdateManager.AttentionRequiredReasonChanged event.

WindowsUpdateGetAdministratorResult

Represents the result of calling GetRegisteredAdministrator.

WindowsUpdateItem

Represents a property bag of information regarding an update that was previously completed.

WindowsUpdateManager

Interface used for monitoring update activity via callbacks, and retrieving update history.

WindowsUpdateManagerScanOptions
WindowsUpdateProgressChangedEventArgs

Event data for the corresponding WindowsUpdateManager.ProgressChanged event.

WindowsUpdateRestartRequestOptions

Represents a property bag of fields that can be configured, and then passed to RequestRestart.

WindowsUpdateScanCompletedEventArgs

Event data for the corresponding WindowsUpdateManager.ScanCompleted event.

Enums

Name Description
WindowsSoftwareUpdateActionResult
WindowsSoftwareUpdateActionType
WindowsSoftwareUpdateArchitecture
WindowsSoftwareUpdateInstallationType
WindowsSoftwareUpdateProviderRegistrationType
WindowsSoftwareUpdateProviderTrustState
WindowsSoftwareUpdateProviderType
WindowsSoftwareUpdateRestartReason
WindowsUpdateAdministratorOptions

Defines constants that specify the administrator options that the caller wants control over when registering with RegisterForAdministration.

WindowsUpdateAdministratorStatus

Defines constants that specify status codes to indicate whether the registration/unregistration of a Windows update administrator succeeded.

WindowsUpdateAttentionRequiredReason

Defines constants that specify a detailed reason as to why attention is required for an update before it can proceed.

Examples

This C# example queries for applicable updates and starts installation.

var updateManager = WindowsUpdateManager.GetDefault();
var updates = await updateManager.GetApplicableUpdatesAsync();
foreach (var update in updates)
{
    Console.WriteLine($"Found update: {update.Title}");
}
await updateManager.StartInstallAsync(updates);

This C# example demonstrates how a user can determine whether their device is receiving preview builds, or whether there are problems preventing the device from getting preview builds.

public string GetErrorMessage() 
{ 
    PreviewBuildsManager manager = PreviewBuildsManager.GetDefault(); 
    if (manager != null) 
    { 
        PreviewBuildsState state = manager.GetCurrentState(); 
        if (state.Properties.ContainsKey("ErrorMessage")) 
        { 
            return state.Properties["ErrorMessage"].ToString(); 
        } 
    } 
    return String.Empty; 
} 

Remarks

  • Use WindowsUpdateManager, WindowsUpdate, and WindowsUpdateAdministrator for general update management on all supported platforms.
  • PreviewBuildsManager and PreviewBuildsState are IoT specific and do not manage general updates on desktop or Server. It's expected that the OEM of the device will create a settings page within the Windows Device Portal for device configuration properties. Information from PreviewBuildsState will be read by the device, then displayed to the user, and then used to register the user's account to the device. After registration, all settings management will be done online through the Windows Insider Program instead of on the device itself.
  • Platform availability and API contracts are documented in individual class reference pages.
API Set Supported Windows Build
Preview Builds 17134 or greater
Windows Update Manager 22621 or greater
Windows Update Administrator 22621 or greater
Windows Software Update 26100 or greater