updates then shudown from command prompt

StrangeTech 21 Reputation points
2022-10-19T20:39:37.867+00:00

I've seen this asked before, but no reasonable answer.

Is there a command that I can put in a batch file that:

  • Checks for updates,
  • Installs updates
  • Then shuts down. (I'll even take a restart at this point!)

I've tried: wuauclt /DetectNow /Updatenow
But it doesn't wait to install updates before moving on

Even if it can check for updates, install updates, THEN move onto the next line. But at the moment there doesn't seem to be any return that the update has done installing

I want to trigger the process, then move on to the next PC.
It doesn't seem like it should be that difficult!

What am I missing?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
9,481 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Dave Patrick 416.4K Reputation points MVP
    2022-10-19T21:29:10.047+00:00

    Give these ones a try.
    https://superuser.com/questions/893862/cmd-command-to-shutdown-pc-and-do-updates

    --please don't forget to upvote and Accept as answer if the reply is helpful--


  2. S.Sengupta 13,366 Reputation points MVP
    2022-10-21T01:26:15.67+00:00

    Download and install the Windows Update PowerShell Module. Then, you can run the command Get-WUInstall -AcceptAll -AutoReboot (there are other switches and arguments to control what updates get installed).

    0 comments No comments

  3. Limitless Technology 43,231 Reputation points
    2022-10-24T07:59:50.07+00:00

    Hi,

    This is possible via PowerShell. If you're interested in trying this, please see the following commands:

    This will install the Windows Update module in PowerShell:
    Install-Module PSWindowsUpdate

    This command will check for updates:
    Get-WindowsUpdate

    Adds Microsoft update for other MS Apps other than Windows (Optional):
    Add-WUServiceManager -MicrosoftUpdate

    To install updates and then reboot please use the following command:
    Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot

    ----------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept as answe

    0 comments No comments