如何强制 Windows 检查更新?

Lan*_*nes 25 windows windows-update

在全新的 Windows 安装(XP 或 7)之后,我如何“强制”Windows 更新?

我不想在一周后进行“旧”Windows 更新,所以可以“一步”完成吗?是否有任何“神奇”命令可以强制 Windows 检查更新,如果有,请安装它们?

Ƭᴇc*_*007 40

除了使用 Windows 更新的通常方式之外,您还可以从命令行强制检查。

打开管理员命令提示符并运行:

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

Wuauclt.exe 是 Windows Update 的 AutoUpdate 客户端,用于检查来自 Microsoft Update 的可用更新(针对 MS Windows 平台的各种版本)。

这不会强制安装。

  • 简写版本是 Windows 键 + R,然后键入 wuauclt /detectnow,然后按 Enter。 (2认同)

Har*_*ton 12

您可以使用脚本自动检查和安装更新。这将适用于 XP 或 Windows 7。

有许多脚本可供下载,这是我的

' 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()

Do

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

  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

  Next

  WScript.Echo

  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.Echo

    WScript.Quit 1

  End If

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

  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

    Next

    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."

Loop 
Run Code Online (Sandbox Code Playgroud)

您可以像这样从命令行运行它:

cscript wsusupdate.vbs
Run Code Online (Sandbox Code Playgroud)

我的脚本只有最低限度的功能,但可能仍然有用。还有其他具有许多附加功能的此类脚本,请尝试使用 Google 搜索。


sur*_*asb 5

要检查更新,请转到“控制面板”、“安全”、“Windows 更新”,然后单击“检查更新”。

在此处输入图片说明