You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过PowerShell触发SCCM强制重启倒计时后无法重启的问题

解决SCCM强制重启倒计时到0后不执行重启的问题

问题分析

核心问题在于RebootBy时间戳配置错误(设置为当前时间而非60分钟后),且未清理旧的RebootData注册表残留,导致倒计时结束后SCCM客户端无法触发重启动作。

修正后的脚本

# 设置重启倒计时时长(分钟)
$rebootInMinutes = 60

# 计算60分钟后的UTC时间戳(配合RebootValueInUTC=1使用)
$rebootByTime = (Get-Date).AddMinutes($rebootInMinutes)
$rebootByTimestamp = [DateTimeOffset]::new($rebootByTime.ToUniversalTime()).ToUnixTimeSeconds()

# 清除旧的RebootData配置,避免残留干扰
Remove-Item -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Recurse -Force -ErrorAction SilentlyContinue

# 创建新的RebootData注册表项
New-Item -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Force -ErrorAction SilentlyContinue | Out-Null

# 设置强制重启关键参数
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'RebootBy' -Value $rebootByTimestamp -PropertyType QWord -Force
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'RebootValueInUTC' -Value 1 -PropertyType DWord -Force
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'NotifyUI' -Value 1 -PropertyType DWord -Force
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'HardReboot' -Value 0 -PropertyType DWord -Force
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'OverrideRebootWindowTime' -Value 0 -PropertyType QWord -Force
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'OverrideRebootWindow' -Value 0 -PropertyType DWord -Force
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'PreferredRebootWindowTypes' -Value @("4") -PropertyType MultiString -Force
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' -Name 'GraceSeconds' -Value 0 -PropertyType DWord -Force

# 触发SCCM重启通知并刷新客户端服务
Start-Process -FilePath "C:\Windows\CCM\CcmRestart.exe" -PassThru -WindowStyle Hidden
Restart-Service -Name CcmExec -Force -ErrorAction SilentlyContinue

关键修改说明

  • RebootBy时间戳:明确设置为60分钟后的UTC时间戳,确保倒计时从60分钟开始递减,而非直接显示0。
  • 清理旧注册表项:删除之前的RebootData键,避免旧参数(如错误的RebootBy值)干扰新配置。
  • GraceSeconds=0:无额外宽限期,倒计时结束后立即执行强制重启。
  • 重启CCMExec服务:强制SCCM客户端加载新的重启配置,避免缓存旧设置导致不生效。

验证步骤

  1. 通过SCCM Client Center远程执行上述脚本。
  2. 确认目标设备弹出60分钟强制重启倒计时窗口。
  3. 等待倒计时结束,检查设备是否自动重启。
  4. 若仍失败,查看SCCM客户端日志C:\Windows\CCM\Logs\RebootManagement.log,排查重启触发的错误信息。

内容的提问来源于stack exchange,提问作者Random206

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 15:42:09