468,107 Members | 1,456 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

Microsoft Update Not Working

NeoPa
32,021 Expert Mod 16PB
Introduction :
I have come across a problem, on a number of occasions, where PCs under my control fail to load new updates successfully. This is true whether they are attempting to apply via the Automatic Updates facility built into the OS or whether accessing the MS Update site directly.

Reason :
The problem is often associated with DLL files not being correctly set up for some reason. Most of the suggested fixes involve registering a list of DLL files on the PC manually. One cause of this I'm aware of in more detail is that whenever you need to use the Repair facility (Boot from an original XP Install CD and choose this option) this is likely to be a side-effect (At least from XP SP2).

Solution(s) :
I will include a couple of CMD files that do the fix for you. The XP version seems to work OK for Windows 2000 as well, but the 2003 version has not yet been tested (I've not come across the problem on any 2003 servers).

Although they mainly reflect the info found in the two links (http://support.microsoft.com/kb/943144 for Windows XP & http://support.microsoft.com/kb/555989 for Windows Server 2003), other files may have been added over time to cover more cases.

Where I have used "@ECHO ON" near the top to show what's going on during execution, you can change this to "@ECHO OFF" if you'd like it to run silently or secretively.

MSUpdateFixXP.Cmd :
Expand|Select|Wrap|Line Numbers
  1. @Rem http://support.microsoft.com/kb/943144
  2.  
  3. @ECHO ON
  4. IF .%1 == ./? GOTO HELP
  5. IF .%1 == .HELP GOTO HELP
  6. IF .%1 == .help GOTO HELP
  7. GOTO MAIN
  8.  
  9. :HELP
  10. ECHO Usage (for XP PCs): MSUpdateFixXP
  11. ECHO This CMD script should re-enable a PC 
  12. ECHO to use Windows Update if it's failing.
  13. ECHO This typically occurs after a REPAIR is done
  14. ECHO from the original XP install CD.
  15. GOTO ENDSCRIPT
  16.  
  17. :MAIN
  18. REGSVR32 /S %WinDir%\System32\Wuapi.Dll
  19. REGSVR32 /S %WinDir%\System32\wups.Dll
  20. REGSVR32 /S %WinDir%\System32\Wuaueng.Dll
  21. REGSVR32 /S %WinDir%\System32\Wucltui.Dll
  22. REGSVR32 /S %WinDir%\System32\Msxml3.Dll
  23.  
  24. NET STOP WUAUSERV >NUL
  25. IF NOT ERRORLEVEL 1 GOTO CONTINUE1
  26. ECHO WUAUSERV (Windows Update & Automatic Service) failed to stop.
  27. GOTO ENDSCRIPT
  28.  
  29. :CONTINUE1
  30. REGSVR32 /S %WinDir%\System32\Wups2.Dll
  31.  
  32. :ENDSCRIPT
  33. NET START WUAUSERV >NUL
  34. ECHO ON
MSUpdateFix2003.Cmd :
Expand|Select|Wrap|Line Numbers
  1. Rem http://support.microsoft.com/kb/555989
  2. Rem NB Both services MUST be stopped before the rename will work.
  3.  
  4. @ECHO OFF
  5. IF .%1 == ./? GOTO HELP
  6. IF .%1 == .HELP GOTO HELP
  7. IF .%1 == .help GOTO HELP
  8. GOTO MAIN
  9.  
  10. :HELP
  11. ECHO Usage: MSUpdateFix [DRASTIC]
  12. ECHO This CMD script should re-enable a PC to use Windows Update if it's failing.
  13. ECHO Generally use the DRASTIC option only if the normal (no parameter) option fails.
  14. GOTO ENDSCRIPT
  15.  
  16. :MAIN
  17. REGSVR32 /S %WinDir%\System32\Vbscript.Dll
  18. REGSVR32 /S %WinDir%\System32\Mshtml.Dll
  19. REGSVR32 /S %WinDir%\System32\Msjava.Dll
  20. REGSVR32 /S %WinDir%\System32\Jscript.Dll
  21. REGSVR32 /S %WinDir%\System32\Msxml.Dll
  22. REGSVR32 /S %WinDir%\System32\Actxprxy.Dll
  23. REGSVR32 /S %WinDir%\System32\Shdocvw.Dll
  24.  
  25. IF .%1 == .DRASTIC GOTO DRASTIC
  26. IF .%1 == .drastic GOTO DRASTIC
  27. GOTO ENDSCRIPT
  28.  
  29. :DRASTIC
  30. NET STOP WUAUSERV
  31. IF NOT ERRORLEVEL 1 GOTO CONTINUE1
  32. ECHO WUAUSERV (Windows Update & Automatic Service) failed to stop.
  33. GOTO ENDSCRIPT
  34.  
  35. :CONTINUE1
  36. NET STOP CryptSvc
  37. IF NOT ERRORLEVEL 1 GOTO CONTINUE2
  38. ECHO CryptSvc (Cryptographic Service) failed to stop.
  39. GOTO ENDSCRIPT
  40.  
  41. :CONTINUE2
  42. DEL /F /S /Q %WinDir%\System32\Catroot2 >NUL
  43. IF NOT ERRORLEVEL 1 GOTO CONTINUE3
  44. ECHO Unable to delete %WinDir%\System32\Catroot2.
  45. GOTO ENDSCRIPT
  46.  
  47. :CONTINUE3
  48. DEL /F /S /Q %WinDir%\SoftDistBup >NUL
  49. REN %WinDir%\SoftwareDistribution SoftDistBup >NUL
  50. IF NOT ERRORLEVEL 1 GOTO CONTINUE4
  51. ECHO Unable to rename %WinDir%\SoftwareDistribution to %WinDir%\SoftDistBup.
  52. GOTO ENDSCRIPT
  53.  
  54. :CONTINUE4
  55. NET START CryptSvc
  56. IF NOT ERRORLEVEL 1 GOTO CONTINUE5
  57. ECHO CryptSvc (Cryptographic Service) failed to restart.
  58. GOTO ENDSCRIPT
  59.  
  60. :CONTINUE5
  61. NET START WUAUSERV
  62. IF NOT ERRORLEVEL 1 GOTO CONTINUE6
  63. ECHO WUAUSERV (Windows Update & Automatic Service) failed to restart.
  64. GOTO ENDSCRIPT
  65.  
  66. :CONTINUE6
  67. REGSVR32 /S Softpub.Dll 
  68. REGSVR32 /S Mssip32.Dll 
  69. REGSVR32 /S Initpki.Dll
  70. REGSVR32 /S Softpub.Dll
  71. REGSVR32 /S Wintrust.Dll
  72. REGSVR32 /S Initpki.Dll
  73. REGSVR32 /S Dssenh.Dll
  74. REGSVR32 /S Rsaenh.Dll
  75. REGSVR32 /S Gpkcsp.Dll
  76. REGSVR32 /S Sccbase.Dll
  77. REGSVR32 /S Slbcsp.Dll
  78. REGSVR32 /S Cryptdlg.Dll
  79. REGSVR32 /S Urlmon.Dll
  80. REGSVR32 /S Shdocvw.Dll 
  81. REGSVR32 /S Msjava.Dll 
  82. REGSVR32 /S Actxprxy.Dll 
  83. REGSVR32 /S Oleaut32.Dll 
  84. REGSVR32 /S Mshtml.Dll 
  85. REGSVR32 /S Msxml.Dll
  86. REGSVR32 /S Msxml2.Dll
  87. REGSVR32 /S Msxml3.Dll
  88. REGSVR32 /S Browseui.Dll
  89. REGSVR32 /S Shell32.Dll
  90. REGSVR32 /S Wuapi.Dll
  91. REGSVR32 /S Wuaueng.Dll
  92. REGSVR32 /S Wuaueng1.Dll
  93. REGSVR32 /S Wucltui.Dll
  94. REGSVR32 /S Wups.Dll
  95. REGSVR32 /S Wuweb.Dll
  96. REGSVR32 /S Jscript.Dll
  97. REGSVR32 /S Atl.Dll 
  98. REGSVR32 /S Mssip32.Dll
  99.  
  100. :ENDSCRIPT
  101. NET START CryptSvc >NUL
  102. NET START WUAUSERV >NUL
  103. ECHO ON
PS :
I can't guarantee this will fix all situations, but I would be interested to hear if this fails to execute for any reason.
May 20 '08 #1
0 9111

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by postings | last post: by
5 posts views Thread by HydroSan | last post: by
6 posts views Thread by Joe Griffith | last post: by
6 posts views Thread by Greg P | last post: by
reply views Thread by Irfan | last post: by
2 posts views Thread by =?Utf-8?B?RWxsZW4=?= | last post: by
reply views Thread by pooch | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.