Install Windows Updates from CMD


Below are a few one liners you can use to install Windows updates from the command line

This one can be straight from Run

C:\Windows\System32\cscript.exe C:\Windows\System32\en-US\WUA_SearchDownloadInstall.vbs

A powershell option would be as below

Install-Module PSWindowsUpdate


Install-WindowsUpdate -install -acceptall

To reboot the server/machine at a given time via CMD you can use the below which will reboot the device at 3AM the following morning.

$StartDate=(GET-DATE); $EndDate=(Get-Date -Hour 3 -Minute 00 -Second 00).AddDays(+1); shutdown /r /t ([math]::ceiling((New-Timespan -Start $StartDate -End $EndDate).TotalSeconds))

Or to reboot at 11:30 that evening run, the difference being the .AddDays(+1)

$StartDate=(GET-DATE); $EndDate=(Get-Date -Hour 23 -Minute 30 -Second 00); shutdown /r /t ([math]::ceiling((New-Timespan -Start $StartDate -End $EndDate).TotalSeconds))

Found priceless insights in this blog? Support the author’s creativity – buy them a coffee!

1 thought on “Install Windows Updates from CMD

  1. I’m extremely pleased to find this site. I want to to thank you for ones time for this particularly fantastic read!!
    I definitely appreciated every little bit of it and I have you book-marked to
    check out new information on your web site.

Leave a Reply

Your email address will not be published. Required fields are marked *