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 two 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.
- 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
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 |