After a fresh Windows install – XP or 7 – how can I "force" Windows updates?

I don't want to have "old" Windows updates after a week, so could it be done in "one step"? Are there any "magical" commands that force Windows to check for updates, and if there are any, install them?

8 Answers 8


You can check for and install updates automatically using a script. This will work in either XP or Windows 7.

There are a number of scripts available for download, here is mine:

' Written in 2007 by Harry Johnston, University of Waikato, New Zealand.
' This code has been placed in the public domain.  It may be freely
' used, modified, and distributed.  However it is provided with no
' warranty, either express or implied.
' Exit Codes:
'   0 = scripting failure
'   1 = error obtaining or installing updates
'   2 = installation successful, no further updates to install
'   3 = reboot needed; rerun script after reboot
' Note that exit code 0 has to indicate failure because that is what
' is returned if a scripting error is raised.

Set updateSession = CreateObject("Microsoft.Update.Session")

Set updateSearcher = updateSession.CreateUpdateSearcher()
Set updateDownloader = updateSession.CreateUpdateDownloader()
Set updateInstaller = updateSession.CreateUpdateInstaller()


  WScript.Echo "Searching for approved updates ..."

  Set updateSearch = updateSearcher.Search("IsInstalled=0")

  If updateSearch.ResultCode <> 2 Then

    WScript.Echo "Search failed with result code", updateSearch.ResultCode
    WScript.Quit 1

  End If

  If updateSearch.Updates.Count = 0 Then

    WScript.Echo "There are no updates to install."
    WScript.Quit 2

  End If

  Set updateList = updateSearch.Updates

  For I = 0 to updateSearch.Updates.Count - 1

    Set update = updateList.Item(I)

    WScript.Echo "Update found:", update.Title



  updateDownloader.Updates = updateList
  updateDownloader.Priority = 3

  Set downloadResult = updateDownloader.Download()

  If downloadResult.ResultCode <> 2 Then

    WScript.Echo "Download failed with result code", downloadResult.ResultCode

    WScript.Quit 1

  End If

  WScript.Echo "Download complete.  Installing updates ..."

  updateInstaller.Updates = updateList

  Set installationResult = updateInstaller.Install()

  If installationResult.ResultCode <> 2 Then

    WScript.Echo "Installation failed with result code", installationResult.ResultCode

    For I = 0 to updateList.Count - 1

      Set updateInstallationResult = installationResult.GetUpdateResult(I)
      WScript.Echo "Result for " & updateList.Item(I).Title & " is " & installationResult.GetUpdateResult(I).ResultCode


    WScript.Quit 1

  End If

  If installationResult.RebootRequired Then

    WScript.Echo "The system must be rebooted to complete installation."

    WScript.Quit 3

  End If

  WScript.Echo "Installation complete."


You run this from the command line like this:

cscript wsusupdate.vbs

My script is only minimally functional but may still be useful. There are other such scripts available with many additional features, try a Google search.

  • I will try this one out! Meanwhile does anyone has any experience with this script? Commented Oct 30, 2011 at 9:59
  • This script exits with <59, 3> <null>: 0x80240044. Any idea why this fails? I've tried looking up the methods that this references, but I couldn't figure out what's happening. Can you point me in the right direction?
    – daviesgeek
    Commented Jun 22, 2014 at 0:34
  • @daviesgeek: 0x80240044 is WU_E_PER_MACHINE_UPDATE_ACCESS_DENIED i.e., you need to be running the script with elevated permissions. Commented Jun 22, 2014 at 0:46
  • Ah...thank you. How would I elevate permissions from the command line? (sorry, I'm a Linux guru, not a Windows person...)
    – daviesgeek
    Commented Jun 22, 2014 at 21:34
  • 1
    Vista/Win7: Open the Start Menu, type cmd and press control-shift-ENTER instead of just ENTER. On Windows 8 I think the Windows-X shortcut key brings up a menu that includes an administrative command line. Or on either system you can find cmd.exe via Explorer, right-click and select Run As Administrator. Commented Jun 23, 2014 at 0:04

Beyond the usual way of using Windows Update, you can force a check from a command-line.

Open an administrator command prompt and run:

C:\> %windir%\system32\wuauclt.exe /detectnow

Wuauclt.exe is the AutoUpdate Client of Windows Update and is used to check for available updates (for the various versions of the MS Windows platform) from Microsoft Update.

This won't force an install.

  • 1
    Just to add: this works on both XP, Vista and 7 as well Commented Oct 29, 2011 at 23:32
  • @Luke It works for Windows 2000 SP4 as well. :) Commented Oct 30, 2011 at 0:02
  • 1
    However, for a fresh install, you'd better check for updates through the GUI (for Windows Vista+) or Windows Update webiste (Pre-Vista). I think this will give the download process higher priority. By default the BITS will only download an update when the network connection is not busy.
    – billc.cn
    Commented Oct 30, 2011 at 2:37
  • 2
    A shorthand version would be Windows key+R and then type wuauclt /detectnow and then press enter. Commented Jun 14, 2012 at 10:57

TO check for updates, go to Control Panel, Security, Windows Update, then click "Check for updates."

enter image description here

  • and on winXP? :) Commented Oct 29, 2011 at 20:43
  • In Windows XP, press Start->All Programs->(Windows|Microsoft) Update and perform an automatic or manual search.
    – Jens Erat
    Commented Oct 30, 2011 at 0:18
  • 1
    This is not for winXP
    – M. of CA
    Commented Dec 3, 2012 at 2:20

Another way to force a true rescan for updates is to wipe the slate clean, by deleting all updates stored in %windir%\Windows\SoftwareDistribution\Download:

    NET STOP wuauserv
    RD /S /Q %windir%\SoftwareDistribution\Download
    NET START wuauserv

Then go to Windows Update, and "Check for updates". It may take an hour, because every updateable file on your system volume is checked (subsequent "Checks for updates" will be fast). This approach eliminates errors, botched updates, and yields a clean, up-to-date system, at least insofar as MS sees it.

  • Thank you, great answer! I was searching for something more forceful than the other answers. My Windows 10 install is botched in some way, and the updates doesn't seem to come any more. I need to force it to update, hope this works.
    – AzP
    Commented Jul 31, 2016 at 10:06

i am using a second party tool called wuinstall for updating fresh windows installation. with that you can automate the whole updating process, including automatic reboots. i think it is one of the fastest ways to get a fresh windows up-to-date without user attendance.


I've found that if, as part of your fresh install on Windows 7, you upgraded IE or you haven't run IE yet and answered the introductory questions, that Windows Update will give you an error. I also haven't found a way to switch Windows Update to Microsoft Update without going through the GUI, so I manually fire up IE, get it initialized and then setup Windows Update through the GUI, so I can switch to Microsoft Update and avoid the initial error. Your mileage may vary.


I had success following the steps on this post, by installing IE8 & WI4.5, it will trigger automatic updates to start downloads.


[Win 10 and above] Assuming you've tried all the other answers (which are good but haven't quite worked for me) and it's still not working -> Pause Updates and then Resume Updates.

  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 26, 2022 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .