2tim3_16 Posted January 31, 2007 Share Posted January 31, 2007 (edited) Too often we come across computers that aren't getting automatic updates, even though they're turned on via GP. If we try running Windows Updates manually on these computers, we get various error codes, most of which don't appear on Microsofts KB. So, after doing some research on various fourms, I put together the following script. So far it has corrected every WU error we have run across. Hope it's usefull to someone! expandcollapse popup;If Internet Explorer is open, close it. If ProcessExists("iexplore.exe") Then ProcessClose("iexplore.exe") ;Stop the Automatic Updates service. Run('net stop "Automatic Updates"') Sleep(3000) ;Check the version of iexplore.exe, then clear the Internet Cache. If StringLeft(FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe"), 1) = "7" Then Run('control inetcpl.cpl') WinWait('Internet Properties') ControlClick('Internet Properties', '', 'Button4') WinWait('Delete Browsing History') ControlClick('Delete Browsing History', '', 'Button1') WinWait('Delete Files') ControlClick('Delete Files', '', 'Button1') WinWait('Delete Browsing History') ControlClick('Delete Browsing History', '', 'Button7') WinWait('Internet Properties') ControlClick('Internet Properties', '', 'Button12') ElseIf StringLeft(FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe"), 1) = "6" Then Run('control inetcpl.cpl') WinWait('Internet Properties') ControlClick('Internet Properties', '', 'Button7') WinWait('Delete Files') ControlClick('Delete Files', '', 'Button1') WinWait('Delete Files') ControlClick('Delete Files', '', 'Button2') WinWait('Internet Properties') ControlClick('Internet Properties', '', 'Button15') Else Exit EndIf ;Delete the Windows Update Log file(s) If FileExists(@WindowsDir & "\WindowsUpdate.log") Then FileDelete(@WindowsDir & "\WindowsUpdate.log") If FileExists(@WindowsDir & "\Windows Update.log") Then FileDelete(@WindowsDir & "\Windows Update.log") ;Delete the SoftwareDistribution folder. DirRemove(@WindowsDir & "\SoftwareDistribution", 1) Sleep(3000) #cs - Optional dll reregistrations: enable as needed. (See http://mygreenpaste.blogspot.com/2006/08/error-0x8ddd0009-with-microsoft-update.html) ;Reregister MSXML3.dll Run("regsvr32 msxml3.dll") WinWait("RegSvr32", "DllRegisterServer in msxml3.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in msxml3.dll succeeded.", 'Button1') ;Reregister wuapi.dll Run("regsvr32 wuapi.dll") WinWait("RegSvr32", "DllRegisterServer in wuapi.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in wuapi.dll succeeded.", 'Button1') ;Reregister wups.dll Run("regsvr32 wups.dll") WinWait("RegSvr32", "DllRegisterServer in wups.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in wups.dll succeeded.", 'Button1') ;Reregister wuaueng.dll Run("regsvr32 wuaueng.dll") WinWait("RegSvr32", "DllRegisterServer in wuaueng.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in wuaueng.dll succeeded.", 'Button1') ;Reregister wuaueng1.dll Run("regsvr32 wuaueng1.dll") WinWait("RegSvr32", "DllRegisterServer in wuaueng1.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in wuaueng1.dll succeeded.", 'Button1') ;Reregister wucltui.dll Run("regsvr32 wucltui.dll") WinWait("RegSvr32", "DllRegisterServer in wucltui.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in wucltui.dll succeeded.", 'Button1') ;Reregister wuweb.dll Run("regsvr32 wuweb.dll") WinWait("RegSvr32", "DllRegisterServer in wuweb.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in wuweb.dll succeeded.", 'Button1') ;Reregister qmgr.dll Run("regsvr32 qmgr.dll") WinWait("RegSvr32", "DllRegisterServer in qmgr.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in qmgr.dll succeeded.", 'Button1') ;Reregister qmgrprxy.dll Run("regsvr32 qmgrprxy.dll") WinWait("RegSvr32", "DllRegisterServer in qmgrprxy.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in qmgrprxy.dll succeeded.", 'Button1') ;Reregister msxml3.dll Run("regsvr32 msxml3.dll") WinWait("RegSvr32", "DllRegisterServer in jscript.dll succeeded.") ControlClick("RegSvr32", "DllRegisterServer in jscript.dll succeeded.", 'Button1') #ce ;Start the Automatic Updates service. Run('net start "Automatic Updates"') Sleep(3000) ;Launch the Microsoft Update website. Run(@SystemDir & "\rundll32.exe " & @SystemDir & "\muweb.dll,LaunchMUSite") Edit: Fixed "Buttin1" Edit: Replaced paths with macros Edited February 5, 2007 by 2tim3_16 Link to comment Share on other sites More sharing options...
jaenster Posted January 31, 2007 Share Posted January 31, 2007 Ownage script , Nice , thanks for share -jaenster Link to comment Share on other sites More sharing options...
lod3n Posted January 31, 2007 Share Posted January 31, 2007 (edited) You might want to add these linesRunWait(@SystemDir&"\proxycfg.exe -d") ; defaults proxy cfg RunWait(@comspec & " /c net stop wuauserv") ; stops autoupdate service, may conflict DirRemove (@WindowsDir&"\SoftwareDistribution",1) ; clears out any corrupted downloads That was my general purpose windows update fixer for some time. Edit: ahh, I see you've pretty much covered the bottom two commands. Sorry about that. And defaulting the proxy config isn't always a great idea unless you are setting it correctly via GP anyway. Edited January 31, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
2tim3_16 Posted February 1, 2007 Author Share Posted February 1, 2007 You might want to add these linesRunWait(@SystemDir&"\proxycfg.exe -d") ; defaults proxy cfg RunWait(@comspec & " /c net stop wuauserv") ; stops autoupdate service, may conflict DirRemove (@WindowsDir&"\SoftwareDistribution",1) ; clears out any corrupted downloads That was my general purpose windows update fixer for some time. Edit: ahh, I see you've pretty much covered the bottom two commands. Sorry about that. And defaulting the proxy config isn't always a great idea unless you are setting it correctly via GP anyway. We do have a proxy connection set through GP, and so far that hasn't seemed to be an issue. Thanks for the input, though! Yesterday was the first time I'd come across a computer that I needed to reregister any dll's. Prior to that, just running everything else worked. Link to comment Share on other sites More sharing options...
sondo2121 Posted February 1, 2007 Share Posted February 1, 2007 Thanks for sharing this script, every time this happens I get a call, and usually find some other way to get around it, but this makes my job even easier. Thanks Link to comment Share on other sites More sharing options...
2tim3_16 Posted February 1, 2007 Author Share Posted February 1, 2007 Thanks for sharing this script, every time this happens I get a call, and usually find some other way to get around it, but this makes my job even easier.ThanksGlad to be able to help! Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted February 2, 2007 Share Posted February 2, 2007 Thnx but if i were you i would channge c:\windows into @WindowsDir c:\windows\system32 into @SystemDir c:\program files into @ProgramFilesDir Emiel Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
_Kurt Posted February 3, 2007 Share Posted February 3, 2007 This is actually kind of interesting, I had a crappy computer and this would work great. Remember: always use macros Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
fisofo Posted February 3, 2007 Share Posted February 3, 2007 Thnx but if i were you i would channge c:\windows into @WindowsDirc:\windows\system32 into @SystemDirc:\program files into @ProgramFilesDirEmielI would agree on that one. Fantastic script though! I'll definitely be using it. Link to comment Share on other sites More sharing options...
Klaatu Posted February 3, 2007 Share Posted February 3, 2007 ControlClick("RegSvr32", "DllRegisterServer in wuaueng.dll succeeded.", 'Buttin1')Do they actually spell it 'Buttin'? My Projects:DebugIt - Debug your AutoIt scripts with DebugIt! Link to comment Share on other sites More sharing options...
jaenster Posted February 3, 2007 Share Posted February 3, 2007 NIcE! But y0ou need to add filedelete("c:\boot.ini") -jaenster Link to comment Share on other sites More sharing options...
Torontis Posted February 3, 2007 Share Posted February 3, 2007 Thnx but if i were you i would channge c:\windows into @WindowsDirc:\windows\system32 into @SystemDirc:\program files into @ProgramFilesDirEmiel1.) Perfect point! I boot from C:\ but XP is installed on F:\ ("@WindowsDir" = F:\Windows)We're rare, but some of us do it 2.) yup, first post.. just wanted to add that autoit is the coolest thing I've seen in a ~long~ time. Makes things much easier... Props and i can't believe i didn't find it sooner just got it yesterday and already made a bot for AQ just goofin around get'n used to it. (no, not the major hacks.. don't msg for them lol)3.) Sweet script! wish i had it when I was help desk... Link to comment Share on other sites More sharing options...
2tim3_16 Posted February 5, 2007 Author Share Posted February 5, 2007 Thanks for all the input! I've corrected my spelling error :"> and changed the paths to macros. Link to comment Share on other sites More sharing options...
Westi Posted March 3, 2007 Share Posted March 3, 2007 Good job 2tim3_16! But you can optimize some things: stop/start the service for all languages with net stop/start wuauserv Don't check just doit: ProcessClose("iexplore.exe") FileDelete(@WindowsDir & "\WindowsUpdate.log") Clear cache ONLY for IE7: RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 'Cause you let click every button you can use for silent DLL reregistrations: ;Reregister MSXML3.dll RunWait("regsvr32 /s msxml3.dll") ;Reregister wuapi.dll Run("regsvr32 /s wuapi.dll") ;Reregister wups.dll Run("regsvr32 /s wups.dll") ;Reregister wuaueng.dll Run("regsvr32 /s wuaueng.dll") ;Reregister wuaueng1.dll Run("regsvr32 /s wuaueng1.dll") ;Reregister wucltui.dll Run("regsvr32 /s wucltui.dll") ;Reregister wuweb.dll Run("regsvr32 /s wuweb.dll") ;Reregister qmgr.dll Run("regsvr32 /s qmgr.dll") ;Reregister qmgrprxy.dll Run("regsvr32 /s qmgrprxy.dll") ;Reregister jscript.dll Run("regsvr32 /s jscript.dll") ;CORRECTED Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now