Preventing Windows Updates During OSD with ConfigMgr

A question came in from the community that hits a very real pain point in ConfigMgr OSD:
“Why is Windows Update suddenly running during my Task Sequence?”

If you’ve spent any time building Task Sequences, you’ve likely seen this in action. You carefully design the flow to deploy Windows, apply drivers, install applications, and run scripts in a controlled order. Then, out of nowhere, Windows Update decides it’s time to do its thing mid-deployment. The result? Paused progress, unpredictable timing, and in some cases, broken application installs.

This post walks you through a simple PowerShell script and Task Sequence integration to disable those updates during OSD, keep your TS deterministic and clean, and bring back control to your deployment workflow

Update January 1, 2026: Restore script added…

Credits: Thank you Matt Wreede (@MattWreede) for initial research and help.

Background – Why this matters

When you use ConfigMgr for OSD, the default behavior is typically to allow Windows Update or Dynamic Update to trigger during setup. That can happen:

  • After image apply, but before applications install
  • During first boot while apps or drivers are being deployed
  • While TS steps are still running and may assume a clean baseline

The result: an update triggers, reboots or driver changes happen unexpectedly, your app installs fail or hang, and your TS ends up taking far longer than it should—or worse, doesn’t complete as expected.
From a performance and reliability standpoint this is one of those “silent villains”.

By explicitly disabling update checks during the TS, you remove the variable. You know exactly what your TS does, when it does it, and what version your machine will be at after imaging.

Workaround

Simply add the below script to your ConfigMgr Task Sequence, to the WinPE phase, so the various registry entries are injected before Windows 11 even boots. To ensure Windows Update didn't have a chance to kick in I enabled settings in three phases of the setup

  1. In WinPE (offline) after the image has been applied, but before booting into Windows
  2. In Windows, via the unattend.xml, in the specialize pass which runs early
  3. In Windows, via the task sequence, after the ConfigMgr client gets installed

Edit the Task Sequence

1. Download the scripts and unattend.xml sample from GitHub: https://github.com/DeploymentResearch/DRFiles/tree/master/Scripts/ConfigMgr/PreventingUpdatesDuringOSD

2. Add the unattend.xml file to a package, and configure the Apply Operating System action to use the Unattend.xml

The Apply Operating System action configured

3. Before the Setup Windows and Configuration Manager action, run the Invoke-DisableWindowsUpdateOffline.ps1 script either embedded in the TS, or in a package.

Example when embedding the script in the task sequence

4. Add an action that copies the Invoke-DisableWindowsUpdateOnline.ps1 script to the task sequence cache, where the unattend.xml will pick it up before the task sequence starts again. Command line when copying from a mapped network share, but you can also copy from a package (requirement if doing Internet-based deployments via CMG):

xcopy H:\Scripts\Invoke-DisableWindowsUpdateOnline.ps1 %_SMSTSMDataPath%\Scripts\ /e /i /y

5. After the Setup Windows and Configuration Manager action, run the Invoke-DisableWindowsUpdateOnline.ps1 script (again) either embedded in the TS, or in a package.

6. Finally, as the last step of your main task sequence, run the Invoke-EnableWindowsUpdateOnline.ps1 script (again) either embedded in the TS, or in a package. This script will remove the configured registry keys and enable the services again.

About the author

Johan Arwidmark

5 1 vote
Article Rating
Subscribe
Notify of
guest
16 Comments
Newest
Oldest Most Voted
Steve
Steve
3 months ago

Johan, thanks for this blog and scripts. I noticed that both the WaaSMedicSvc and
Windows Update services are typically configured for Manual startup. Maybe you can update the script to configure them per the Windows defaults?

d3Xt3r
d3Xt3r
4 months ago

Question for everyone reading this: how did you know/realise that it was Windows Updates that was causing your OSD to fail? While we've had mysterious random app install / OSD failures for a while (which appear to be resolved now), I've never actually seen Windows Update kick in. We are a mostly on-prem outfit, our PCs can't talk to Microsoft's update servers even if they get a direct internet connection. All updates are done via ConfigMgr and GPO sets our WU update URLs etc. As far as I understand, once the GPO applies, Windows Update shouldn't kick in at all… Read more »

Matt Wreede
Matt Wreede
4 months ago
Reply to  d3Xt3r

For this specific flow, it's Windows itself doing the updates, because it 'wants' to. If you don't do ANYTHING, then Windows has a non zero chance of installing updates, just because it's Windows :). This is all during OSD, and not 'past' that. This would, during OSD, show up in the Setup Event log; you'll legitimately see it going out, downloading updates, and installing updates, completely out of the scope of ConfigMgr. Because yes, as you said: ConfigMgr itself isn't even initialized yet. I don't think there is anything SPECIFIC in Provisioning Mode that disables WINDOWS itself from updating, and… Read more »

jordan mastel
jordan mastel
5 months ago

This did help, though in the middle of my task sequence windows update service was still re-enabling itself after about 10 miutes. Causing the task sequence to get stuck on what ever app is being installed. I added the following to the disable online script and enable script. Disable-AndStopService -ServiceName "WaaSMedicSvc" #ensure tasks are disabled schtasks /Change /TN "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan" /Disable schtasks /Change /TN "\Microsoft\Windows\UpdateOrchestrator\Schedule Maintenance Work" /Disable schtasks /Change /TN "\Microsoft\Windows\UpdateOrchestrator\Backup Scan" /Disable schtasks /Change /TN "\Microsoft\Windows\UpdateOrchestrator\Reboot" /Disable schtasks /Change /TN "\Microsoft\Windows\UpdateOrchestrator\USO_UxBroker" /Disable Re-enabling: schtasks /Change /TN "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan" /Enable schtasks /Change /TN "\Microsoft\Windows\UpdateOrchestrator\Schedule Maintenance Work" /Enable schtasks /Change… Read more »

Kevin
Kevin
6 months ago

Johan, Nice post! I am running MDT standalone. Will this process still apply? If so what is your advice? THANK YOU!

Mike Compton
Mike Compton
7 months ago

Invoke-EnableWindowsUpdateOnline.ps1, line 164
Invoke-DisableWindowsUpdateOnline.ps1, line 257

I don't think "Disable-AndStopService" or "Enable-AndStartService" are valid PS commands 😉

Mike Compton
Mike Compton
9 months ago

Hi Johan

These scripts disable Windows Update and Edge Updates, but there is nothing in this post of the scripts to reset/reenable those later.

Is that because it is not required and Windows automatically handles that automatically after the TS completes, or simply because it is not covered in this post?

Doug
Doug
9 months ago

It looks like the post got cut off because it ends mid-sentence. Also, which repository/folder are the scripts and unattend.xml located in?

Jimmy Martin
Jimmy Martin
9 months ago

Hi Johan! Long time admirer… saw you and Niehaus a long time back at MMS! I dont find any of the scripts you mention here on this site or github. Also, different subject… I havent seen you with advice on the secureboot drama. I've read several folks approaches to it. Since you haven't opined, is there a person's writeup/solution you see as best path?


>