Pausing windows update using powershell

Spindler, Yosef Yaaqov 0 Reputation points
2023-05-18T07:51:30.97+00:00

Hi,

I am trying to remotely pause windows update using a powershell script.

I have tried installing PSWindowsUpdate module on the remote PC and then running: Set-WindowsUpdateAutoUpdateOption -AutoUpdateOption 2

This didnt work and i am getting that Set-WindowsUpdateAutoUpdateOption is missing.

Then i tried setting this reg key HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoUpdate to 1.

However, after a restart the settings UI still shows like windowsupdate is not paused.

What is the right method to pause windows upadate through a PS1 script?

Thanks,

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Ivan Arnaudov 10 Reputation points
    2023-12-18T23:54:02.07+00:00

    Hi, you're most likely looking at the corresponding PowerShell code that is behind a Settings app button click on Pause updates. A quick look around inside the UX hive on windows registry and you can spot the following example below. You can utilise the this PowerShell code on Windows 10/11 as administrator:

    #One liner to set Windows 10 updates to pause (suspend) for +35 days from now (today):

    $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
    

    #one liner to check status (expiry date) of the same:

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

    please mark my response as answer if it helps you achieve your goal or if it brings you closer to resolution. thanks a lot.

    2 people found this answer helpful.
    0 comments No comments

  2. Limitless Technology 44,746 Reputation points
    2023-05-19T11:05:49.6633333+00:00

    Hello,

    Thank you for your question and for reaching out with your question today.

    Please see the script example below for how to disable Windows Update:

    set the Windows Update service to "disabled"

    sc.exe config wuauserv start=disabled

    display the status of the service

    sc.exe query wuauserv

    stop the service

    sc.exe stop wuauserv

    If the reply was helpful, please don’t forget to upvote or accept as answer.


  3. Spindler, Yosef Yaaqov 0 Reputation points
    2023-05-22T10:09:35.98+00:00

    Hi,

    This disables and stops the windows update service. but when i open windows update setting page i can still see windows updates are not paused.

    I need to pause windows update so it wont try to update the PC.

    Thanks,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.