安装 Windows 更新后如何取消 Windows Server 2012 中的自动重启

安装 Windows 更新后如何取消 Windows Server 2012 中的自动重启

问题是:“关机 -a”选项不起作用,没有“稍后重启”按钮,只有一个 15 分钟的倒计时器,并且无法取消它。

我该怎么办?我从某处读到,如果我锁定,它将冻结计时器直到我下次登录,但我不想等到“时间合适”。

答案1

计时器是 Windows 更新服务的一部分,而不是操作系统本身,因此您可以通过停止服务来停止它,尝试net stop "windows update"这样做应该可以解决问题。

但这只是临时解决方案,因为稍后重新启动时服务将再次启动,我猜你真正想要的是强制 Windows 在更新计划时间重新启动,基本上你需要添加一个注册表项来执行此操作,请尝试此链接http://support.microsoft.com/kb/2835627

答案2

我建议使用 PSWindowsUpdate powershell 模块。它允许您忽略重启。

Import-Module PSWindowsUpdate
Get-WUInstall -AcceptAll -IgnoreReboot

如果您收到错误“未加载指定的模块‘PSWindowsUpdate’,因为未找到有效的模块文件......”您可能需要使用此脚本下载并安装它。

$webDeployURL = "https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/file/41459/43/PSWindowsUpdate.zip"
$filePath = "$($env:TEMP)\PSWindowsUpdate.zip"
(New-Object System.Net.WebClient).DownloadFile($webDeployURL, $filePath)
$shell = New-Object -ComObject Shell.Application
$zipFile = $shell.NameSpace($filePath)
$destinationFolder = $shell.NameSpace("C:\Program Files\WindowsPowerShell\Modules")
$copyFlags = 0x00
$copyFlags += 0x04 # Hide progress dialogs
$copyFlags += 0x10 # Overwrite existing files
$destinationFolder.CopyHere($zipFile.Items(), $copyFlags)
# Clean up
Remove-Item -Force -Path $filePath
Import-Module PSWindowsUpdate

相关内容