4

In Windows 10 it is possible to pause windows updates for up to 35 days using the "Windows Update - Advanced Options" settings dialog (please see screenshot).

Question 1: How do i accomplish that via powershell or command-line ?

Question 2: How do i find out until which date windows updates are paused via powershell or commandline? Or alternatively: How do i find out how many days are left until windows updates are resumed ?

windows update - advanced settings dialog

Malady
  • 251
  • 1
  • 12
impact79
  • 69
  • 1
  • 3

3 Answers3

2

Here is an easy way to do it in Powershell by amending the Registry:

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseUpdatesExpiryTime' -Value "2020-07-31T00:00:00Z"

Finally to query the current setting:

Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings'| Select-Object PauseUpdatesExpiryTime

This has been tested, the only side-effect is that the date setting dropdown is greyed out in the Advanced setting page.

Ozymandius
  • 68
  • 1
  • 8
  • Just realised you needed to set the update pause value for 35 days: `$pause = (Get-Date).AddDays(35)` `$pause = $pause.ToUniversalTime().ToString( "yyyy-MM-ddTHH:mm:ssZ" )` `Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseUpdatesExpiryTime' -Value $pause` – Ozymandius Jun 20 '20 at 07:18
  • as shown the new lines are stripped out and it doesn't work. need extra ; to work, like this: $pause = (Get-Date).AddDays(35) $pause = $pause.ToUniversalTime().ToString( "yyyy-MM-ddTHH:mm:ssZ" ) Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseUpdatesExpiryTime' -Value $pause – Al Ro May 05 '21 at 18:24
2

Thanks Ozymanduis for the suggestion. I tried it and it worked fine. Probably windows 10 needs the exact time format to accept the pause updates function and to work properly. However I went looking into the registery where those keys are, after pressing the pause updates function. It seems that there are other REG keys which are created during the "button press". And those are

PauseFeatureUpdatesStartTime (Where the time format is set on "now")

PauseFeatureUpdatesEndTime (Where the time format is set on "in 35 days")

PauseQualityUpdatesStartTime (Where the time format is set on "now")

PauseQualityUpdatesEndTime (Where the time format is set on "in 35 days")

So I just added those keys to the equation like this

$pause = (Get-Date).AddDays(35)
$pause = $pause.ToUniversalTime().ToString( "yyyy-MM-ddTHH:mm:ssZ" )
$pause_start = (Get-Date)
$pause_start = $pause_start.ToUniversalTime().ToString( "yyyy-MM-ddTHH:mm:ssZ" )
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseUpdatesExpiryTime' -Value $pause                                                                                        
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseFeatureUpdatesStartTime' -Value $pause_start
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseFeatureUpdatesEndTime' -Value $pause
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseQualityUpdatesStartTime' -Value $pause_start
Set-itemproperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseQualityUpdatesEndTime' -Value $pause  

Now I hope it will really pause those updates. I remember having tried out the "pause" REG keys function couple of years ago alternatively to the "disable windows updates" function, but somehow it used to resume those updates within the grace period regardless of the date set, which was kind of annoying. I will keep you updated.

EDIT: I added the reg entries in the same ps file to avoid the autoupdate feature to start like this,

New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Force
New-ItemProperty -Path  'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name 'NoAutoUpdate' -PropertyType DWORD -Value 1  

I do it as soon as possible when our machines are deployed to avoid the update process to begin (because if it does you're pretty much screwed) and it seems to work pretty fine now:

Andy McRae
  • 525
  • 7
  • 15
  • so does this setting actually end up pausing updates? – Al Ro May 05 '21 at 18:27
  • hi. Actually thanks for your comment, it reminded me to add a small piece pf code in the "EDIT" section and it seems to work pretty fine now (windows 10 20H2 etc.) – Andy McRae May 10 '21 at 11:06
2

one-liner that does it, based on Ozymanduis's comment:

$pause = (Get-Date).AddDays(35); $pause = $pause.ToUniversalTime().ToString( "yyyy-MM-ddTHH:mm:ssZ" ); Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name 'PauseUpdatesExpiryTime' -Value $pause
Al Ro
  • 466
  • 2
  • 11