WSUS 客户端配置

WSUS 更新服务 · 第 5 篇 · 适用于 Windows Server 2019 / 2022 / 2025

📑 目录

  1. 概述
  2. 组策略配置
  3. 注册表配置
  4. 客户端排错
  5. 常见问题

1. 概述

WSUS 客户端通过组策略或注册表配置指向 WSUS 服务器,定期检测、下载和安装更新。Windows Server 2019-2025 和 Windows 10/11 客户端均支持 WSUS 管理。

2. 组策略配置

1

打开组策略管理(gpmc.msc),创建或编辑 GPO

2

导航到:计算机配置 → 策略 → 管理模板 → Windows 组件 → Windows 更新

3

配置"指定 Intranet Microsoft 更新服务位置":启用并设置更新服务器为 http://wsus.iehang.cn:8530

4

配置"配置自动更新":选择"4 - 自动下载并计划安装",设置安装时间为每周日凌晨 2:00

5

配置"允许客户端目标设置":启用并设置目标组名称(如"生产服务器组")

6

将 GPO 链接到目标 OU,运行 gpupdate /force 刷新策略

PowerShell
# 创建 GPO
New-GPO -Name "WSUS-客户端配置" | New-GPLink -Target "OU=Servers,DC=iehang,DC=cn"

# 配置 WSUS 服务器地址
Set-GPRegistryValue -Name "WSUS-客户端配置" -Key "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" -ValueName "WUServer" -Type String -Value "http://wsus.iehang.cn:8530"
Set-GPRegistryValue -Name "WSUS-客户端配置" -Key "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" -ValueName "WUStatusServer" -Type String -Value "http://wsus.iehang.cn:8530"

# 配置自动更新(4=自动下载并计划安装)
Set-GPRegistryValue -Name "WSUS-客户端配置" -Key "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ValueName "AUOptions" -Type DWord -Value 4
Set-GPRegistryValue -Name "WSUS-客户端配置" -Key "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ValueName "ScheduledInstallDay" -Type DWord -Value 0
Set-GPRegistryValue -Name "WSUS-客户端配置" -Key "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ValueName "ScheduledInstallTime" -Type DWord -Value 2

# 配置目标组
Set-GPRegistryValue -Name "WSUS-客户端配置" -Key "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" -ValueName "TargetGroup" -Type String -Value "生产服务器组"
Set-GPRegistryValue -Name "WSUS-客户端配置" -Key "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" -ValueName "TargetGroupEnabled" -Type DWord -Value 1

Write-Host "WSUS 组策略配置完成"

3. 注册表配置

对于未加入域的计算机,可直接修改注册表配置 WSUS:

PowerShell
# 注册表配置脚本(独立服务器使用)
$regPath = "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate"
New-Item -Path $regPath -Force
Set-ItemProperty -Path $regPath -Name "WUServer" -Value "http://wsus.iehang.cn:8530"
Set-ItemProperty -Path $regPath -Name "WUStatusServer" -Value "http://wsus.iehang.cn:8530"

$auPath = "$regPath\AU"
New-Item -Path $auPath -Force
Set-ItemProperty -Path $auPath -Name "AUOptions" -Value 4
Set-ItemProperty -Path $auPath -Name "NoAutoUpdate" -Value 0

# 重启 Windows Update 服务
Restart-Service wuauserv
Write-Host "WSUS 客户端注册表配置完成"

4. 客户端排错

客户端无法连接 WSUS 时的排查步骤:

  1. 检查网络连通性:Test-NetConnection wsus.iehang.cn -Port 8530
  2. 查看 Windows Update 日志:Get-WindowsUpdateLog
  3. 重置 Windows Update 组件:
PowerShell
# 重置 Windows Update 组件
Stop-Service wuauserv, cryptSvc, bits, msiserver
Remove-Item C:\Windows\SoftwareDistribution\Download\* -Recurse -Force
Start-Service wuauserv, cryptSvc, bits, msiserver
Write-Host "Windows Update 组件已重置"

5. 常见问题

Q1:客户端显示"无法连接到更新服务"?

检查 WSUS 网站是否运行(IIS 管理器),确认端口 8530/8531 防火墙放行,验证客户端 DNS 能解析 WSUS 服务器名称。

Q2:客户端报告到 WSUS 但看不到更新?

检查计算机组分配是否正确,确认更新已同步且已审批,等待客户端下次检测周期(默认 22 小时)或手动运行检测。