Windows.Management.Update Namespace
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Windows.Management.Update namespace provides APIs for managing Windows Update operations across Windows devices. It serves several distinct purposes:
- General update management: Use classes such as WindowsUpdateManager, WindowsUpdateAdministrator, and WindowsUpdate to discover, download, install, and monitor updates on Windows desktop, Server, and IoT devices - covering both Preview and non-Preview builds.
- Windows Software Update provider platform: Use WindowsSoftwareUpdateProvider, WindowsSoftwareUpdate, WindowsSoftwareUpdateProviderStatus, and the software-update members of WindowsUpdateManager to author and host update providers for your app that integrate with the Windows Update Orchestrator. A provider discovers updates for specific software during a scan, then performs actions (download, install, deploy, restart) when the orchestrator schedules them — reusing the same scheduling, reboot coordination, and policies as Windows Update.
- IoT Insider Preview enablement: Use PreviewBuildsManager and PreviewBuildsState to opt IoT devices into Windows Insider Preview builds and retrieve registration state. It's expected that the OEM of the device will create a settings page within the Windows Device Portal for device configuration properties.
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 |
Represents a single software update that a provider reports to the Windows Update Orchestrator, including its identity, versions, sizes, the actions required to apply it, and its current state. |
| WindowsSoftwareUpdateActionInfo |
Describes how a provider performs a single update action by specifying the file to invoke, its arguments, and the action type. |
| WindowsSoftwareUpdateActionProgress |
Describes the progress of the action that's currently being performed on a WindowsSoftwareUpdate. |
| WindowsSoftwareUpdateActionResultInfo |
Describes the outcome of the most recently completed action for a WindowsSoftwareUpdate. |
| WindowsSoftwareUpdateAppPackageInfo |
Describes the MSIX/AppX application package that an AppPackage WindowsSoftwareUpdate installs. |
| WindowsSoftwareUpdateApprovalInfo |
Describes the conditions under which a WindowsSoftwareUpdate is approved to proceed. |
| WindowsSoftwareUpdateExecutionInfo |
Describes the set of actions a provider runs to apply an executable or PowerShell WindowsSoftwareUpdate. |
| WindowsSoftwareUpdateIdentity |
Identifies the installed product that a WindowsSoftwareUpdate targets, either by MSI product code or by MSIX package family name. |
| WindowsSoftwareUpdateLocalizationInfo |
Provides a localized title, description, and more info URL for a WindowsSoftwareUpdate in a specific language. |
| WindowsSoftwareUpdateOptionalActionInfo |
Describes the optional "close-and-deploy", "close-and-install", and "close-and-restart" action variants for a WindowsSoftwareUpdate — the actions that run when the target application must be closed first. |
| WindowsSoftwareUpdateOptionalInfo |
Carries optional metadata for a WindowsSoftwareUpdate, including its category, localized content, and compliance timing. |
| WindowsSoftwareUpdateProvider |
Represents a Windows Software Update provider package on disk and provides the operations to validate, register, and unregister it with the Windows Update Orchestrator. |
| WindowsSoftwareUpdateProviderActionResult |
Describes the outcome that a provider reports for a software-update action, including the result, any required restart, and error information. |
| WindowsSoftwareUpdateProviderPayloadFileInfo |
Describes a single payload file that belongs to a WindowsSoftwareUpdateProvider, including its hash and code-signing trust state. |
| WindowsSoftwareUpdateProviderStatus |
The channel a provider uses to report results back to the Windows Update Orchestrator: scan results, action progress, and action results. It also notifies the provider when the orchestrator requests cancellation. |
| WindowsSoftwareUpdateResult |
Represents the result of a software-update operation, such as submitting a scan result, reporting progress, or reporting an action result. |
| WindowsSoftwareUpdateScanResult |
Represents the result of a software-update scan, including whether it succeeded and the WindowsSoftwareUpdate objects that were discovered. |
| WindowsSoftwareUpdateVersion |
Represents a four-part version number (major, minor, revision-major, and revision-minor) for a WindowsSoftwareUpdate. |
| WindowsUpdate |
A WindowsUpdate is a property bag that describes a single pending or in-progress update — its identity and metadata, classification flags, End-User License Agreement (EULA) state, deadline, and the progress and result of the action currently being performed on it. |
| 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 a registered administrator to control Windows Update activity on a device — gating scans, updates, and update actions behind explicit approval, and requesting or canceling restarts. |
| 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 |
Provides a unified view of update activity on a device. Use WindowsUpdateManager to start scans, enumerate the updates that apply to the device, review recently completed updates, and monitor scan, work, and progress activity through events — without polling. Starting with the Windows Software Update provider platform, WindowsUpdateManager also enumerates the registered software-update providers and performs software-update scans. |
| 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 |
Defines constants that specify the outcome of a software-update action that a provider reports through a WindowsSoftwareUpdateProviderActionResult. |
| WindowsSoftwareUpdateActionType |
Defines constants that specify an action that a provider performs to move a WindowsSoftwareUpdate through its lifecycle. |
| WindowsSoftwareUpdateArchitecture |
Defines constants that specify the processor architecture that a WindowsSoftwareUpdateAppPackageInfo applies to. |
| WindowsSoftwareUpdateCategory |
Defines constants that classify a WindowsSoftwareUpdate by the kind of payload it delivers. |
| WindowsSoftwareUpdateIdentityType |
Defines constants that specify how the product targeted by a WindowsSoftwareUpdateIdentity is identified. |
| WindowsSoftwareUpdateInstallationType |
Defines constants that specify how a WindowsSoftwareUpdate is installed on the device. |
| WindowsSoftwareUpdateProviderRegistrationType |
Defines constants that specify the registration state of a WindowsSoftwareUpdateProvider. |
| WindowsSoftwareUpdateProviderTrustState |
Defines constants that specify the code-signing trust state of a WindowsSoftwareUpdateProvider or one of its payload files. |
| WindowsSoftwareUpdateProviderType |
Defines constants that specify how a registered WindowsSoftwareUpdateProvider is invoked to perform scan and update actions. |
| WindowsSoftwareUpdateRestartReason |
Defines constants that specify why a restart is required to complete a software-update action. |
| 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. |
| WindowsUpdateManagerScanMode |
Defines constants that specify how a software-update scan is performed when calling WindowsUpdateManager.PerformScan. |
Examples
Scan for and enumerate applicable updates
This C# example creates a WindowsUpdateManager, starts a scan, and enumerates the applicable updates when the scan completes.
using System;
using Windows.Management.Update;
var updateManager = new WindowsUpdateManager("MyClientId");
updateManager.ScanCompleted += (manager, args) =>
{
foreach (WindowsUpdate update in manager.GetApplicableUpdates())
{
Console.WriteLine($"Applicable update: {update.Title}");
}
};
// Scan as if the user selected "Check for updates".
updateManager.StartScan(userInitiated: true);
Author a software-update provider
The Windows Software Update provider platform lets you plug a custom update source into the Windows Update Orchestrator. A provider is invoked in SYSTEM context once per operation: during a scan it builds WindowsSoftwareUpdate objects and submits them; during an action it reports progress and a final result through a WindowsSoftwareUpdateProviderStatus.
The following snippets show that core flow in C#, C++/WinRT, and PowerShell. Complete, buildable provider samples — including the provider.json manifest, code-signing, and registration steps — are published in the microsoft/windows-uop repository.
C#
using System.Collections.Generic;
using Windows.Management.Update;
// Scan: report the updates this provider offers.
void PerformScan(string providerId, IEnumerable<WindowsSoftwareUpdate> updates)
{
var status = new WindowsSoftwareUpdateProviderStatus(providerId);
WindowsSoftwareUpdateResult result = status.SetScanResult(true, 0, 0, updates);
}
// Action: report progress, then the final result.
void PerformAction(string providerId)
{
var status = new WindowsSoftwareUpdateProviderStatus(providerId);
for (ulong i = 0; i <= 100; i += 10)
{
status.SetActionProgress(i, 100);
}
var actionResult = new WindowsSoftwareUpdateProviderActionResult(
WindowsSoftwareUpdateActionResult.Succeeded,
WindowsSoftwareUpdateRestartReason.None,
resultCode: 0,
extendedError: 0);
status.SetActionResult(actionResult);
}
C++/WinRT
#include <winrt/Windows.Management.Update.h>
#include <winrt/Windows.Foundation.Collections.h>
using namespace winrt::Windows::Management::Update;
using namespace winrt::Windows::Foundation::Collections;
// Scan: report the updates this provider offers.
void PerformScan(winrt::hstring const& providerId, IVector<WindowsSoftwareUpdate> const& updates)
{
WindowsSoftwareUpdateProviderStatus status{ providerId };
auto result = status.SetScanResult(true, S_OK, 0, updates);
}
// Action: report progress, then the final result.
void PerformAction(winrt::hstring const& providerId)
{
WindowsSoftwareUpdateProviderStatus status{ providerId };
for (uint64_t i = 0; i <= 100; i += 10)
{
status.SetActionProgress(i, 100);
}
WindowsSoftwareUpdateProviderActionResult actionResult{
WindowsSoftwareUpdateActionResult::Succeeded,
WindowsSoftwareUpdateRestartReason::None,
0, // resultCode
0 }; // extendedError
status.SetActionResult(actionResult);
}
PowerShell
# Scan: report the updates this provider offers.
$providerStatus = [Windows.Management.Update.WindowsSoftwareUpdateProviderStatus]::new($ProviderId)
$statusResult = $providerStatus.SetScanResult($true, 0, 0, $UpdateCollection)
# Action: report progress, then the final result.
$providerStatus = [Windows.Management.Update.WindowsSoftwareUpdateProviderStatus]::new($ProviderId)
for ($i = 0; $i -le 100; $i += 10) {
[void]$providerStatus.SetActionProgress($i, 100)
}
$actionResult = [Windows.Management.Update.WindowsSoftwareUpdateProviderActionResult]::new(
[Windows.Management.Update.WindowsSoftwareUpdateActionResult]::Succeeded,
[Windows.Management.Update.WindowsSoftwareUpdateRestartReason]::None,
0, # resultCode
0) # extendedError
[void]$providerStatus.SetActionResult($actionResult)
Determine Insider Preview build status (IoT)
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.
- Use WindowsSoftwareUpdateProvider, WindowsSoftwareUpdateProviderStatus, WindowsSoftwareUpdate, and the software-update members of WindowsUpdateManager to author and host update providers for your app (the Windows Update Orchestration Platform). For provider authoring, onboarding, signing, and registration guidance — along with complete C#, C++, and PowerShell samples — see the microsoft/windows-uop repository.
- 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 |