0

Part of configuration is to run all the Windows Updates. I am trying to figure out how to express it with Powershell DSC. Seems like the best is to ensure that the windows updates are scheduled regularly.

I found xWindowsUpdateAgent DSC resource, but it does not allow to specify the schedule itself, only to ensure that the updates are scheduled.

So, is it possible to ensure a concrete windows update schedule?

1
  • I'm quite sure that you can easily achieve the same by setting up the required registries, though I don't have any experience of DSC! May 2, 2018 at 17:35

1 Answer 1

0

xWindowsUpdateAgent is from the xWindowsUpdate DSC module. The resources can be used as part of a solution to a strictly defined schedule, but it's not complete by itself.

You can configure the machine in two ways:

  1. Use xWindowsUpdateAgent to set the category, and source of updates. Using ScheduledInstallation will rely on the local Windows Update schedule to download and install updates.

  2. Use DSC’s remediation schedule to drive update installs (exclusively or in addition to the Windows Update agent’s schedule).
    This requires using UpdateNow in your xWindowsUpdateAgent configuration, and setting the Local Configuration Manager’s Configuration Mode to ApplyAndAutoCorrect.
    Updates will be checked for and installed based on the ConfigurationModeFrequencyMins.
    You will also need to decide a reboot strategy for the updates, using either RebootIfNeeded or the machine’s reboot cycle for updating.

To achieve an absolute schedule, you could create a scheduled task to Start-DSCConfiguration on a configuration based on the second option above with UpdateNow.

This isn't the most straightforward approach, and would reevaluate any other settings in your configuration as well on the same schedule.

You could also use a scheduled task more directly to simply automate calls to the Windows Update Agent itself on a schedule (wuauclt.exe /updatenow), bypassing DSC. Creating a task like this is certainly doable with DSC, but I don't know of any existing resource that does it all in one. You'd need to write your own.

7
  • The readme for xWindowsUpdate module will be updated shortly at the git repository. May 17, 2018 at 21:35
  • But it does not allow me to specify the schedule, does it?
    – mark
    May 18, 2018 at 0:44
  • You're right. I focused in on the capabilities of the module once I ran into documentation errors. I updated my answer. Short version - you could add more code to get the job done partially using the module, but it's not a super natural fit. There are more direct ways to do it. DSC itself isn't a perfect fit for doing a doing a singular task on a rigid schedule, and this module doesn't cover all the configuration needed to create a strictly scheduled task for that singular purpose. May 18, 2018 at 15:17
  • Would you be able to suggest how to enforce a certain windows updates schedule with DSC? Also, could you explain why you think it is not a good fit for DSC?
    – mark
    May 18, 2018 at 17:42
  • DSC itself normally runs on an interval, rather than a strict schedule. You could certainly create a scheduled task to drive DSC via Start-DSCConfiguration - but if you're going that route, you can just easily use DSC to create a scheduled task that drives the windows update agent directly. Normally you wouldn't have a configuration that does a singular task, either. Make sense? May 19, 2018 at 1:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .