可以使用 SConfig 菜单或通过命令行在 Windows Server Core 安装上配置 Windows 更新设置。 本文介绍配置 Windows 更新设置所需的步骤和命令。 服务器核心允许通过以下方式安装 Windows 更新:
使用自动 Windows 更新或 Windows Server Update Services (WSUS)。 通过使用 Windows 更新(自动或 WSUS 命令行工具)可以服务运行 Server Core 安装的服务器。
Manually. 即使在不使用 Windows 更新或 WSUS 的组织中,也可以手动应用更新。
Prerequisites
- 设备必须具有有效的 Internet 连接。
- The user account performing Windows updates should be a member of the Administrators, Domain Admins, or Enterprise Admins group.
- 如果服务器是域的成员,则必须通过组策略正确配置 Windows 更新代理。 服务器核心设备仅支持选项 4,自动下载并计划安装,如 使用组策略配置自动更新中所述。 另请参阅 Windows 和 Windows Server 的组策略设置参考。
查看已安装的更新
在向 Server Core 添加新更新之前,请运行以下命令之一,检查是否已安装最新的 Windows 更新:
Get-Hotfix | Sort-Object InstalledOn
Get-ComputerInfo -Property OsHotFixes
systeminfo
wmic qfe list
通过 SConfig 配置 Windows 更新
从 Windows Server 2002 开始,登录后,SConfig 菜单将加载。 If the SConfig menu doesn't appear, run sconfig
and select Enter. 加载菜单后,执行以下步骤来配置设置:
Type 5, select Enter. Select one of these options, then select Enter.
- 1) Automatic
- 2) Download only
- 3) Manual
Type 6, select Enter. Select one of these options, then select Enter.
- 1) All quality updates
- 2) Recommended quality updates only
- 3) Feature updates
通过命令行配置 Windows 更新
Tip
VBScript 已被弃用。 VBScript 仍作为按需功能(FoD)提供,并预安装在 Windows Server 2025 中,但请考虑使用 PowerShell 或 SConfig 菜单配置 Windows 更新设置。 若要详细了解 VBScript 的弃用,请参阅 https://techcommunity.microsoft.com/blog/windows-itpro-blog/vbscript-deprecation-timelines-and-next-steps/4148301。
若要验证当前的 Windows 更新设置,请运行以下命令:
%systemroot%\system32\cscript %systemroot%\system32\scregedit.wsf /AU /v
若要启用自动更新,请运行以下命令:
Net stop wuauserv
%systemroot%\system32\cscript %systemroot%\system32\scregedit.wsf /AU /v 4
Net start wuauserv
若要禁用自动更新,请运行以下命令:
Net stop wuauserv
%systemroot%\system32\cscript %systemroot%\system32\scregedit.wsf /AU /v 1
Net start wuauserv
若要强制 Windows 更新立即检测和安装可用更新,请运行以下命令:
wuauclt /detectnow
可能需要重新启动计算机,具体取决于安装的更新。 系统不会通知哪些更新需要重新启动。 To determine if the installation process completed, open Task Manager by running taskmgr
and verify that either the wuauclt, or Trusted Installer processes aren't actively running.
手动应用 Windows Server 更新
若要在安装组合服务堆栈更新(SSU)和 LCU 包后删除最新的累积更新(LCU),请使用 Remove-WindowsPackage
cmdlet 或 Dism /Remove-Package
命令行选项,并将 LCU 包名称用作参数。 可以使用以下命令查找包名称:DISM /online /get-packages。
.msu
下载更新文件,并选择首选方法来安装更新。
在权限提升的 PowerShell 提示符下,运行以下命令:
Add-WindowsPackage -Online -Path "<folder_path>" -PackagePath "\<update_file>.msu" -PreventPending
如果程序包或 Windows 映像存在挂起的联机操作,则 -PreventPending
参数会跳过程序包的安装。
若要手动卸载更新,请先运行以下命令来确定更新名称:
Get-WindowsPackage -online -PackageName "*KB<NUM>*"
然后运行以下命令以卸载更新:
Remove-WindowsPackage -Online -PackageName "<package_name>"
使用 Azure 更新管理器进行更新
还可以从 Azure 门户使用 Azure 更新管理器 更新 Windows Server Core 安装。