Troubleshooting and Fixing Windows Update Hangs on Windows Server 2012 R2 Standard


2 views

When dealing with a Windows Server 2012 R2 Standard that hasn't updated since March, we're observing several critical symptoms:

  • Update checks run indefinitely without completing
  • Windows Update service cannot be properly restarted
  • Multiple failed update attempts shown in history
  • System requires reboot to retry updates

Before diving into solutions, run these PowerShell commands to gather system information:

# Check Windows Update service status
Get-Service -Name wuauserv | Select-Object Status, StartType

# View update history
Get-WindowsUpdateLog -LogPath $env:USERPROFILE\Desktop\WindowsUpdate.log

# Check for pending updates
$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$Searcher.Search("IsInstalled=0").Updates | Select-Object Title

The root causes typically fall into these categories with corresponding solutions:

Corrupted Windows Update Components

This batch script resets Windows Update components:

@echo off
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver

ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 catroot2.old

net start wuauserv
net start cryptSvc
net start bits
net start msiserver

Pending Update Conflicts

For systems with stuck updates, try this PowerShell sequence:

# Clean pending updates
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting" -Force -ErrorAction SilentlyContinue

# Reset Windows Update policies
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f

Manual Update Installation

When automatic updates fail, download and install them manually:

# Find missing updates
$UpdateSession = New-Object -ComObject Microsoft.Update.Session
$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
$MissingUpdates = $UpdateSearcher.Search("IsInstalled=0 and Type='Software'").Updates

# Download updates
$Downloader = $UpdateSession.CreateUpdateDownloader()
$Downloader.Updates = $MissingUpdates
$Downloader.Download()

# Install updates
$Installer = $UpdateSession.CreateUpdateInstaller()
$Installer.Updates = $MissingUpdates
$InstallationResult = $Installer.Install()

Service Dependencies Verification

Ensure all required services are running with proper dependencies:

# Check service dependencies
Get-Service -Name wuauserv -RequiredServices | Format-Table -AutoSize

# Verify service configuration
sc.exe qc wuauserv

Implement these regular maintenance tasks:

# Monthly cleanup script
Cleanmgr /sageset:65535
Cleanmgr /sagerun:65535

Dism /Online /Cleanup-Image /RestoreHealth
sfc /scannow

html

When Windows Server 2012 R2 gets stuck in the "Checking for updates" state with no progress for hours, it typically indicates one of these underlying issues:

  • Corrupted Windows Update components
  • Pending updates that failed to install properly
  • WSUS client-server communication problems
  • System file corruption

Before attempting repairs, run these commands in an elevated PowerShell window to gather diagnostic data:

# Check Windows Update service status
Get-Service -Name wuauserv,bits,appidsvc,cryptsvc | Select-Object Name,Status

# View Windows Update log errors
Get-WinEvent -LogName "Microsoft-Windows-WindowsUpdateClient/Operational" -MaxEvents 20 | 
Where-Object {$_.Level -le 3} | Format-Table TimeCreated,Id,Message -AutoSize

# Check for pending updates
$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$SearchResult = $Searcher.Search("IsInstalled=0")
$SearchResult.Updates | Select-Object Title,Identity

Here's the complete repair sequence I've successfully used on dozens of 2012 R2 servers:

# Stop all update-related services
Stop-Service -Name wuauserv,bits,appidsvc,cryptsvc -Force

# Rename the SoftwareDistribution folder
Rename-Item -Path $env:systemroot\SoftwareDistribution -NewName SoftwareDistribution.old -Force

# Reset Windows Update components
regsvr32 /s atl.dll
regsvr32 /s urlmon.dll
regsvr32 /s mshtml.dll
regsvr32 /s shdocvw.dll
regsvr32 /s browseui.dll
regsvr32 /s jscript.dll
regsvr32 /s vbscript.dll
regsvr32 /s scrrun.dll
regsvr32 /s msxml.dll
regsvr32 /s msxml3.dll
regsvr32 /s msxml6.dll
regsvr32 /s actxprxy.dll
regsvr32 /s softpub.dll
regsvr32 /s wintrust.dll
regsvr32 /s dssenh.dll
regsvr32 /s rsaenh.dll
regsvr32 /s gpkcsp.dll
regsvr32 /s sccbase.dll
regsvr32 /s slbcsp.dll
regsvr32 /s cryptdlg.dll
regsvr32 /s oleaut32.dll
regsvr32 /s ole32.dll
regsvr32 /s shell32.dll
regsvr32 /s initpki.dll
regsvr32 /s wuapi.dll
regsvr32 /s wuaueng.dll
regsvr32 /s wuaueng1.dll
regsvr32 /s wucltui.dll
regsvr32 /s wups.dll
regsvr32 /s wups2.dll
regsvr32 /s wuweb.dll
regsvr32 /s qmgr.dll
regsvr32 /s qmgrprxy.dll
regsvr32 /s wucltux.dll
regsvr32 /s muweb.dll
regsvr32 /s wuwebv.dll

# Re-register BITS and Windows Update
netsh winsock reset
netsh winsock reset proxy

# Restart services
Start-Service -Name cryptsvc
Start-Service -Name bits
Start-Service -Name wuauserv

For servers with failed updates from months ago (like the February 17 failures mentioned), you'll need to manually clear the update queue:

# Clear all pending updates
$Session = New-Object -ComObject Microsoft.Update.Session
$Pending = $Session.CreateUpdateInstaller()
$Pending.Updates = $Session.CreateUpdateSearcher().Search("IsInstalled=0").Updates
$Pending.Uninstall()

# Then force a fresh update check
$UpdateSvc = New-Object -ComObject Microsoft.Update.ServiceManager
$UpdateSvc.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")

When all else fails, manually download and install the latest Servicing Stack Update (SSU) from Microsoft's Update Catalog:

  1. Visit https://www.catalog.update.microsoft.com
  2. Search for "Servicing Stack Update for Windows Server 2012 R2"
  3. Download the latest SSU (e.g., KB5031408)
  4. Install it manually using:
wusa.exe C:\path\to\update.msu /quiet /norestart