One of the most common issues this week has been Windows Updates not installing properly.  The most commonly accepted first step to solving the problem is reset Windows Update.

Here is my simple batch file to reset Windows Update (On Vista and up-level clients, make sure to run as Administrator)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@echo off
REM Reset Windows update batch file (kb971058)
cls

:START
set /p osname=ver
set /p aggro="Aggressive Fix(N/y): "
rem if /i %aggro%==n ( GOTO :NO ) ELSE ( if /i %Aggro%==y ( GOTO :AGGRESSIVE ELSE ( GOTO :ERR ) )
if /i %aggro%==n ( GOTO :MAIN ) ELSE ( if /i %Aggro%==y ( GOTO :MAIN ) ELSE ( GOTO :ERR ) )

:ERR
CLS
Echo Invalid option!!
echo.
GOTO START


:MAIN
net stop bits
net stop wuauserv

Del "%ALLUSERSPROFILE%Application DataMicrosoftNetworkDownloaderqmgr*.dat"
if /i %aggro%==n ( GOTO :DLLS ) ELSE ( if /i %Aggro%==y ( GOTO :AGGRESIVE ) )


:DLLS

Ren %systemroot%SoftwareDistributionDataStore *.bak
Ren %systemroot%SoftwareDistributionDownload *.bak
Ren %systemroot%system32catroot2 *.bak

cd /d %windir%system32

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

if ver | find /i "xp" ( proxycfg.exe -d )
if ver | find /i "2003" (proxycfg.exe -d )
if ver | find /i "vista" ( bitsadmin.exe /reset /allusers ) else (netsh winhttp reset proxy)

GOTO :END


:AGGRESIVE
REM Aggressive Fix
rem %systemroot%SoftwareDistributionDataStore
rem %systemroot%SoftwareDistributionDownload
rem %systemroot%system32catroot2

sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)

GOTO :DLLS
REM End of Aggressive fix

:END
netsh winsock reset
net start bits
net start wuauserv
shutdown -r -t 60 -c "Restart for Update fix"

Advertisements