Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Latest commit

 

History

History
218 lines (177 loc) · 7.03 KB

windows-update-management.md

File metadata and controls

218 lines (177 loc) · 7.03 KB

Windows Update Management

The Windows Update Management allows control over the following aspects:

  • "How"
    • How the updates are applied (time, source, etc). This is grouped under Windows Update Policy and Windows Update Reboot Policy.
    • The policy is split into two because the update reboot policy is more likely to be set independently of of the rest of the update policies.
  • "What"
    • What updates are installed, installable, pending, etc. This is group under Windows Updates.

Windows Update Policy

The Windows Update Policy supports Source Policy.

Configuration

The Windows Update Policy can be configured through the "windowsUpdatePolicy" node in the desired properties section as follows:

"desired" : {
    "windows" : {
        "windowsUpdatePolicy": <see below>
        }
    }
}
  • "windowsUpdatePolicy" can be set to one of the following:
    • "no-apply-no-report" : This means no desired state, and no reported state will be stored in the device twin.
    • "no-apply-yes-report": This means no desired state will be stored in the device twin, but reported state will.
    • A json object of the following format:
    {
        "applyProperties" : {
            "activeHoursStart": <see below>,
            "activeHoursEnd": <see below>,
            "allowAutoUpdate": <see below>,
            "allowUpdateService": <see below>,
            "branchReadinessLevel":  <see below>,
            "deferFeatureUpdatesPeriod": <see below>,
            "deferQualityUpdatesPeriod": <see below>,
            "pauseFeatureUpdates": <see below>,
            "pauseQualityUpdates": <see below>,
            "scheduledInstallDay": <see below>,
            "scheduledInstallTime": <see below>,
            "ring": <see below>,
            "sourcePriority": "local|remote"
        }
        "reportProperties" : <see below>
    }
  • For a full documentation on what each field does, see the Policy CSP MSDN page.
  • The "ring" field can be set to one of the following values:
    • "EarlyAdopter"
    • "Preview"
    • "GeneralAvailability"
  • The "reportProperties" can be set to one of the following values:
    • "yes": tells the DM client to report the Windows Update Policy state of the device.
    • "no": tells the DM client to not report the Windows Update Policy section in the reported properties. This can be useful to free some room in the Device Twin.

Reporting

The device current state of the Windows Update Policy can be inspected through the "windowsUpdatePolicy" node in the reported properties section as follows:

"reported" : {
    "windows" : {
        "windowsUpdatePolicy": <see below>
    }
}
  • "windowsUpdatePolicy" can be set to one of the following values:
    • "no-report"
    • A json object of the following format:
 {
    "activeHoursStart": <see below>,
    "activeHoursEnd": <see below>,
    "allowAutoUpdate": <see below>,
    "allowUpdateService": <see below>,
    "branchReadinessLevel":  <see below>,
    "deferFeatureUpdatesPeriod": <see below>,
    "deferQualityUpdatesPeriod": <see below>,
    "pauseFeatureUpdates": <see below>,
    "pauseQualityUpdates": <see below>,
    "scheduledInstallDay": <see below>,
    "scheduledInstallTime": <see below>,
    "ring": <see below>,
    "sourcePriority": "local|remote"
}
  • See documentation of individual properties under the Configuration section above.

.Net API

    Namespace:
    Microsoft.Devices.Management
    public enum WindowsUpdateRing
    {
        EarlyAdopter,
        Preview,
        GeneralAvailability
    }

    public class WindowsUpdateRingState
    {
        public WindowsUpdateRing ring;
        public SettingsPriority settingsPriority;
    }
    Class:
    DeviceManagementClient
    Methods:
    public async Task SetWindowsUpdateRingAsync(WindowsUpdateRingState state);
    public async Task GetWindowsUpdateRingAsync();

Windows Updates

Configuration

The Windows Updates can be configured through the "windowsUpdates" node in the desired properties section as follows:

"desired" : {
    "windows" : {
        "windowsUpdates": {
            "approved": "<see below>"
        }
    }
}

For a full documentation on what each field does, see the Update CSP MSDN page.

Reporting

The device current state of the Windows Updates can be inspected through the "windowsUpdates" node in the reported properties section as follows:

"reported" : {
    "windows" : {
        "windowsUpdates": {
            "deferUpgrade": <see below>,
            "lastScanTime": "<see below>",
            "pendingReboot": "<see below>",
            "installable": "<see below>",
            "failed": "<see below>",
            "approved": "<see below>",
            "installed": "<see below>"
        }
    }
}

For a full documentation on what each field does, see the Update CSP MSDN page.

.Net API

    Namespace:
    Microsoft.Devices.Management
    Data Structure:
    public class DeviceManagement
    {
        public struct WindowsUpdateStatus
        {
            public string installed;
            public string approved;
            public string failed;
            public string installable;
            public string pendingReboot;
            public string lastScanTime;
            public bool deferUpgrade;
        }
    }
    Class:
    DeviceManagement
    Methods:
    public static DeviceManagement CreateWithoutAzure();
    public async Task GetWindowsUpdateStatusAsync();

Sample:

    DeviceManagement dm = DeviceManagement.CreateWithoutAzure();
    DeviceManagement.WindowsUpdateStatus status = await dm.GetWindowsUpdateStatusAsync();
    bool pending = !String.IsNullOrEmpty(status.pendingReboot);

Home Page | Library Reference