Advertisement
Guest User

Windows update resetter

a guest
Jan 16th, 2017
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 26.63 KB | None | 0 0
  1. :: ==================================================================================
  2. :: NAME     : Reset Windows Update Tool.
  3. :: DESCRIPTION     : This script reset the Windows Update Components.
  4. :: AUTHOR     : Manuel Gil.
  5. :: VERSION     : 10.5.0.0
  6. :: ==================================================================================
  7.  
  8.  
  9. :: Set console.
  10. :: /************************************************************************************/
  11. :mode
  12.  
  13. echo off
  14. title Reset Windows Update Tool.
  15. mode con cols=78 lines=32
  16. color 17
  17. cls
  18.  
  19. goto getValues
  20. :: /************************************************************************************/
  21.  
  22.  
  23. :: Print Top Text.
  24. :: /*************************************************************************************/
  25. :print
  26.  
  27. cls
  28. echo.
  29. echo.%name% [Version: %version%]
  30. echo.Reset Windows Update Tool.
  31. echo.
  32. echo.%*
  33. echo.
  34.  
  35. goto :eof
  36. :: /*************************************************************************************/
  37.  
  38.  
  39. :: Add Value in the Registry.
  40. :: /*************************************************************************************/
  41. :addReg
  42.  
  43. reg add "%~1" /v "%~2" /t "%~3" /d "%~4" /f
  44.  
  45. goto :eof
  46. :: /*************************************************************************************/
  47.  
  48.  
  49. :: Load the system values.
  50. :: /************************************************************************************/
  51. :getValues
  52.  
  53. for /f "tokens=4-5 delims=[] " %%a in ('ver') do set version=%%a%%b
  54. for %%a in (%version%) do set version=%%a
  55.  
  56. if %version% EQU 5.1.2600 (
  57.    :: Name: "Microsoft Windows XP"
  58.     set name=Microsoft Windows XP
  59.    :: Family: Windows 5
  60.     set family=5
  61.    :: Compatibility: Yes
  62.     set allow=Yes
  63. ) else if %version% EQU 5.2.3790 (
  64.    :: Name: "Microsoft Windows XP Professional x64 Edition"
  65.     set name=Microsoft Windows XP Professional x64 Edition
  66.    :: Family: Windows 5
  67.     set family=5
  68.    :: Compatibility: Yes
  69.     set allow=Yes
  70. ) else if %version% EQU 6.0.6000 (
  71.    :: Name: "Microsoft Windows Vista"
  72.     set name=Microsoft Windows Vista
  73.    :: Family: Windows 6
  74.     set family=6
  75.    :: Compatibility: Yes
  76.     set allow=Yes
  77. ) else if %version% EQU 6.0.6001 (
  78.    :: Name: "Microsoft Windows Vista SP1"
  79.     set name=Microsoft Windows Vista SP1
  80.    :: Family: Windows 6
  81.     set family=6
  82.    :: Compatibility: Yes
  83.     set allow=Yes
  84. ) else if %version% EQU 6.0.6002 (
  85.    :: Name: "Microsoft Windows Vista SP2"
  86.     set name=Microsoft Windows Vista SP2
  87.    :: Family: Windows 6
  88.     set family=6
  89.    :: Compatibility: Yes
  90.     set allow=Yes
  91. ) else if %version% EQU 6.1.7600 (
  92.    :: Name: "Microsoft Windows 7"
  93.     set name=Microsoft Windows 7
  94.    :: Family: Windows 7
  95.     set family=7
  96.    :: Compatibility: Yes
  97.     set allow=Yes
  98. ) else if %version% EQU 6.1.7601 (
  99.    :: Name: "Microsoft Windows 7 SP1"
  100.     set name=Microsoft Windows 7 SP1
  101.    :: Family: Windows 7
  102.     set family=7
  103.    :: Compatibility: Yes
  104.     set allow=Yes
  105. ) else if %version% EQU 6.2.9200 (
  106.    :: Name: "Microsoft Windows 8"
  107.     set name=Microsoft Windows 8
  108.    :: Family: Windows 8
  109.     set family=8
  110.    :: Compatibility: Yes
  111.     set allow=Yes
  112. ) else if %version% EQU 6.3.9200 (
  113.    :: Name: "Microsoft Windows 8.1"
  114.     set name=Microsoft Windows 8.1
  115.    :: Family: Windows 8
  116.     set family=8
  117.    :: Compatibility: Yes
  118.     set allow=Yes
  119. ) else if %version% EQU 6.3.9600 (
  120.    :: Name: "Microsoft Windows 8.1 Update 1"
  121.     set name=Microsoft Windows 8.1 Update 1
  122.    :: Family: Windows 8
  123.     set family=8
  124.    :: Compatibility: Yes
  125.     set allow=Yes
  126. ) else if %version% EQU 10.0.10049 (
  127.    :: Name: "Microsoft Windows 10 Technical Preview"
  128.     set name=Microsoft Windows 10 Technical Preview
  129.    :: Family: Windows 10
  130.     set family=10
  131.    :: Compatibility: Yes
  132.     set allow=Yes
  133. ) else if %version% EQU 10.0.10240 (
  134.    :: Name: "Microsoft Windows 10 Threshold 1"
  135.     set name=Microsoft Windows 10 Threshold 1
  136.    :: Family: Windows 10
  137.     set family=10
  138.    :: Compatibility: Yes
  139.     set allow=Yes
  140. ) else if %version% EQU 10.0.10586 (
  141.    :: Name: "Microsoft Windows 10 Threshold 2"
  142.     set name=Microsoft Windows 10 Threshold 2
  143.    :: Family: Windows 10
  144.     set family=10
  145.    :: Compatibility: Yes
  146.     set allow=Yes
  147. ) else if %version% EQU 10.0.14390 (
  148.    :: Name: "Microsoft Windows 10 Insider Preview"
  149.     set name=Microsoft Windows 10 Insider Preview
  150.    :: Family: Windows 10
  151.     set family=10
  152.    :: Compatibility: Yes
  153.     set allow=Yes
  154. ) else (
  155.    :: Name: "Unknown"
  156.     set name=Unknown
  157.    :: Compatibility: No
  158.     set allow=No
  159. )
  160.  
  161. call :print %name% detected . . .
  162.  
  163. if %allow% EQU Yes goto permission
  164.  
  165. call :print Sorry, this Operative System is not compatible with this tool.
  166.  
  167. echo.    An error occurred while attempting to verify your system.
  168. echo.    Can this using a business or test version.
  169. echo.
  170. echo.    If not, verify that your system has the correct security fix.
  171. echo.
  172.  
  173. echo.Press any key to continue . . .
  174. pause>nul
  175. goto :eof
  176. :: /************************************************************************************/
  177.  
  178.  
  179. :: Checking for Administrator elevation.
  180. :: /************************************************************************************/
  181. :permission
  182.  
  183. openfiles>nul 2>&1
  184.  
  185. if %errorlevel% EQU 0 goto terms
  186.  
  187. call :print Checking for Administrator elevation.
  188.  
  189. echo.    You are not running as Administrator.
  190. echo.    This tool cannot do it's job without elevation.
  191. echo.
  192. echo.    You need run this tool as Administrator.
  193. echo.
  194.  
  195. echo.Press any key to continue . . .
  196. pause>nul
  197. goto :eof
  198. :: /************************************************************************************/
  199.  
  200.  
  201. :: Terms.
  202. :: /*************************************************************************************/
  203. :terms
  204.  
  205. call :print Terms and Conditions of Use.
  206.  
  207. echo.    The methods inside this tool modify files and registry settings.
  208. echo.    While you are tested and tend to work, We not take responsibility for
  209. echo.    the use of this tool.
  210. echo.
  211. echo.    This tool is provided without warranty. Any damage caused is your
  212. echo.    own responsibility.
  213. echo.
  214. echo.    As well, batch files are almost always flagged by anti-virus, feel free
  215. echo.    to review the code if you're unsure.
  216. echo.
  217.  
  218. choice /c YN /n /m "Do you want to continue with this process? (Yes/No) "
  219. if %errorlevel% EQU 1 goto menu
  220. if %errorlevel% EQU 2 goto close
  221.  
  222. echo.An unexpected error has occurred.
  223. echo.
  224. echo.Press any key to continue . . .
  225. pause>nul
  226. goto menu
  227. :: /*************************************************************************************/
  228.  
  229.  
  230. :: Menu of tool.
  231. :: /*************************************************************************************/
  232. :menu
  233.  
  234. call :print This tool reset the Windows Update Components.
  235.  
  236. echo.    1. Open the system protection.
  237. echo.    2. Reset Windows Update Components.
  238. echo.    3. Delete temporary files in Windows.
  239. echo.    4. Open the Internet Explorer options.
  240. echo.    5. Scans all protected system files.
  241. echo.    6. Scan the image to check for corruption.
  242. echo.    7. Check the detected corruptions.
  243. echo.    8. Repair the image.
  244. echo.    9. Clean up the superseded components.
  245. echo.    10. Change invalid values in the Registry.
  246. echo.    11. Reset the Winsock settings.
  247. echo.    12. Search updates.
  248. echo.    13. Explore other local solutions.
  249. echo.    14. Explore other online solutions.
  250. echo.    15. Download Diagnostic.
  251. echo.    16. Restart your PC.
  252. echo.
  253. echo.                                            ?. Help.    0. Close.
  254. echo.
  255.  
  256. set /p option=Select an option:
  257.  
  258. if %option% EQU 0 (
  259.     goto close
  260. ) else if %option% EQU 1 (
  261.     call :sysProtection
  262. ) else if %option% EQU 2 (
  263.     call :components
  264. ) else if %option% EQU 3 (
  265.     call :temp
  266. ) else if %option% EQU 4 (
  267.     call :iOptions
  268. ) else if %option% EQU 5 (
  269.     call :sfc
  270. ) else if %option% EQU 6 (
  271.     call :dism1
  272. ) else if %option% EQU 7 (
  273.     call :dism2
  274. ) else if %option% EQU 8 (
  275.     call :dism3
  276. ) else if %option% EQU 9 (
  277.     call :dism4
  278. ) else if %option% EQU 10 (
  279.     call :regedit
  280. ) else if %option% EQU 11 (
  281.     call :winsock
  282. ) else if %option% EQU 12 (
  283.     call :updates
  284. ) else if %option% EQU 13 (
  285.     call :local
  286. ) else if %option% EQU 14 (
  287.     call :online
  288. ) else if %option% EQU 15 (
  289.     call :diagnostic
  290. ) else if %option% EQU 16 (
  291.     call :restart
  292. ) else if %option% EQU ? (
  293.     call :help
  294. ) else (
  295.     echo.
  296.     echo.Invalid option.
  297.     echo.
  298.     echo.Press any key to continue . . .
  299.     pause>nul
  300. )
  301.  
  302. goto menu
  303. :: /*************************************************************************************/
  304.  
  305.  
  306. :: Open system protection.
  307. :: /*************************************************************************************/
  308. :sysProtection
  309.  
  310. call :print Opening the system protection.
  311.  
  312. if %family% NEQ 5 (
  313.     start systempropertiesprotection
  314. ) else (
  315.     echo.
  316.     echo.Sorry, this option is not available on this Operative System.
  317.     echo.
  318.     echo.Press any key to continue . . .
  319.     pause>nul
  320. )
  321.  
  322. goto :eof
  323. :: /*************************************************************************************/
  324.  
  325.  
  326. :: Run the reset Windows Update components.
  327. :: /*************************************************************************************/
  328. :components
  329.  
  330. :: ----- Stopping the Windows Update services -----
  331. call :print Stopping the Windows Update services.
  332. net stop bits
  333.  
  334. call :print Stopping the Windows Update services.
  335. net stop wuauserv
  336.  
  337. call :print Stopping the Windows Update services.
  338. net stop appidsvc
  339.  
  340. call :print Stopping the Windows Update services.
  341. net stop cryptsvc
  342.  
  343. :: ----- Checking the services status -----
  344. call :print Checking the services status.
  345.  
  346. sc query bits | findstr /I /C:"STOPPED"
  347. If %errorlevel% NEQ 0 (
  348.     echo.    Failed to stop the BITS service.
  349.     echo.
  350.     echo.Press any key to continue . . .
  351.     pause>nul
  352.     goto close
  353. )
  354.  
  355. call :print Checking the services status.
  356.  
  357. sc query wuauserv | findstr /I /C:"STOPPED"
  358. if %errorlevel% NEQ 0 (
  359.     echo.    Failed to stop the Windows Update service.
  360.     echo.
  361.     echo.Press any key to continue . . .
  362.     pause>nul
  363.     goto close
  364. )
  365.  
  366. call :print Checking the services status.
  367.  
  368. sc query appidsvc | findstr /I /C:"STOPPED"
  369. if %errorlevel% NEQ 0 (
  370.     sc query appidsvc | findstr /I /C:"OpenService FAILED 1060"
  371.     if %errorlevel% NEQ 0 (
  372.         echo.    Failed to stop the Application Identity service.
  373.         echo.
  374.         echo.Press any key to continue . . .
  375.         pause>nul
  376.         goto close
  377.     )
  378. )
  379.  
  380. call :print Checking the services status.
  381.  
  382. sc query cryptsvc | findstr /I /C:"STOPPED"
  383. If %errorlevel% NEQ 0 (
  384.     echo.    Failed to stop the Cryptographic Services service.
  385.     echo.
  386.     echo.Press any key to continue . . .
  387.     pause>nul
  388.     goto close
  389. )
  390.  
  391. :: ----- Delete the qmgr*.dat files -----
  392. call :print Deleting the qmgr*.dat files.
  393.  
  394. del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
  395.  
  396. :: ----- Renaming the softare distribution folders backup copies -----
  397. call :print Renaming the softare distribution folders backup copies.
  398.  
  399. cd /d %SYSTEMROOT%
  400.  
  401. if exist "%SYSTEMROOT%\winsxs\pending.xml.bak" (
  402.     del /s /q /f "%SYSTEMROOT%\winsxs\pending.xml.bak"
  403. )
  404. if exist "%SYSTEMROOT%\SoftwareDistribution.bak" (
  405.     rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution.bak"
  406. )
  407. if exist "%SYSTEMROOT%\system32\Catroot2.bak" (
  408.     rmdir /s /q "%SYSTEMROOT%\system32\Catroot2.bak"
  409. )
  410. if exist "%SYSTEMROOT%\WindowsUpdate.log.bak" (
  411.     del /s /q /f "%SYSTEMROOT%\WindowsUpdate.log.bak"
  412. )
  413.  
  414. call :print Renaming the softare distribution folders backup copies.
  415.  
  416. if exist "%SYSTEMROOT%\winsxs\pending.xml" (
  417.     takeown /f "%SYSTEMROOT%\winsxs\pending.xml"
  418.     attrib -r -s -h /s /d "%SYSTEMROOT%\winsxs\pending.xml"
  419.     ren "%SYSTEMROOT%\winsxs\pending.xml" pending.xml.bak
  420. )
  421. if exist "%SYSTEMROOT%\SoftwareDistribution" (
  422.     attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution"
  423.     ren "%SYSTEMROOT%\SoftwareDistribution" SoftwareDistribution.bak
  424. )
  425. if exist "%SYSTEMROOT%\system32\Catroot2" (
  426.     attrib -r -s -h /s /d "%SYSTEMROOT%\system32\Catroot2"
  427.     ren "%SYSTEMROOT%\system32\Catroot2" Catroot2.bak
  428. )
  429. if exist "%SYSTEMROOT%\WindowsUpdate.log" (
  430.     attrib -r -s -h /s /d "%SYSTEMROOT%\WindowsUpdate.log"
  431.     ren "%SYSTEMROOT%\WindowsUpdate.log" WindowsUpdate.log.bak
  432. )
  433.  
  434. :: ----- Reset the BITS service and the Windows Update service to the default security descriptor -----
  435. call :print Reset the BITS service and the Windows Update service to the default security descriptor.
  436.  
  437. sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
  438. sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
  439.  
  440. :: ----- Reregister the BITS files and the Windows Update files -----
  441. call :print Reregister the BITS files and the Windows Update files.
  442.  
  443. cd /d %WINDIR%\system32
  444. regsvr32.exe /s atl.dll
  445. regsvr32.exe /s urlmon.dll
  446. regsvr32.exe /s mshtml.dll
  447. regsvr32.exe /s shdocvw.dll
  448. regsvr32.exe /s browseui.dll
  449. regsvr32.exe /s jscript.dll
  450. regsvr32.exe /s vbscript.dll
  451. regsvr32.exe /s scrrun.dll
  452. regsvr32.exe /s msxml.dll
  453. regsvr32.exe /s msxml3.dll
  454. regsvr32.exe /s msxml6.dll
  455. regsvr32.exe /s actxprxy.dll
  456. regsvr32.exe /s softpub.dll
  457. regsvr32.exe /s wintrust.dll
  458. regsvr32.exe /s dssenh.dll
  459. regsvr32.exe /s rsaenh.dll
  460. regsvr32.exe /s gpkcsp.dll
  461. regsvr32.exe /s sccbase.dll
  462. regsvr32.exe /s slbcsp.dll
  463. regsvr32.exe /s cryptdlg.dll
  464. regsvr32.exe /s oleaut32.dll
  465. regsvr32.exe /s ole32.dll
  466. regsvr32.exe /s shell32.dll
  467. regsvr32.exe /s initpki.dll
  468. regsvr32.exe /s wuapi.dll
  469. regsvr32.exe /s wuaueng.dll
  470. regsvr32.exe /s wuaueng1.dll
  471. regsvr32.exe /s wucltui.dll
  472. regsvr32.exe /s wups.dll
  473. regsvr32.exe /s wups2.dll
  474. regsvr32.exe /s wuweb.dll
  475. regsvr32.exe /s qmgr.dll
  476. regsvr32.exe /s qmgrprxy.dll
  477. regsvr32.exe /s wucltux.dll
  478. regsvr32.exe /s muweb.dll
  479. regsvr32.exe /s wuwebv.dll
  480.  
  481. :: ----- Resetting Winsock -----
  482. call :print Resetting Winsock.
  483. netsh winsock reset
  484.  
  485. :: ----- Resetting WinHTTP Proxy -----
  486. call :print Resetting WinHTTP Proxy.
  487.  
  488. if %family% NEQ 5 (
  489.     proxycfg.exe -d
  490. ) else (
  491.     netsh winhttp reset proxy
  492. )
  493.  
  494. :: ----- Starting the Windows Update services -----
  495. call :print Starting the Windows Update services.
  496. net start bits
  497.  
  498. call :print Starting the Windows Update services.
  499. net start wuauserv
  500.  
  501. call :print Starting the Windows Update services.
  502. net start appidsvc
  503.  
  504. call :print Starting the Windows Update services.
  505. net start cryptsvc
  506.  
  507. :: ----- End process -----
  508. call :print The operation completed successfully.
  509.  
  510. echo.Press any key to continue . . .
  511. pause>nul
  512. goto :eof
  513. :: /*************************************************************************************/
  514.  
  515.  
  516. :: Delete temporary files in Windows.
  517. :: /*************************************************************************************/
  518. :temp
  519.  
  520. call :print Deleting temporary files in Windows.
  521.  
  522. del /s /f /q "%TEMP%\*.*"
  523.  
  524. echo.
  525. echo.Press any key to continue . . .
  526. pause>nul
  527. goto :eof
  528. :: /*************************************************************************************/
  529.  
  530.  
  531. :: Open the Internet Explorer options.
  532. :: /*************************************************************************************/
  533. :iOptions
  534.  
  535. call :print Opening the Internet Explorer options.
  536.  
  537. start InetCpl.cpl
  538.  
  539. goto :eof
  540. :: /*************************************************************************************/
  541.  
  542.  
  543. :: Scans all protected system files.
  544. :: /*************************************************************************************/
  545. :sfc
  546.  
  547. call :print Scans all protected system files.
  548.  
  549. if %family% NEQ 5 (
  550.     sfc /scannow
  551. ) else (
  552.     echo.Sorry, this option is not available on this Operative System.
  553. )
  554.  
  555. echo.
  556. echo.Press any key to continue . . .
  557. pause>nul
  558. goto :eof
  559. :: /*************************************************************************************/
  560.  
  561.  
  562. :: Scan the image to check for corruption.
  563. :: /*************************************************************************************/
  564. :dism1
  565.  
  566. call :print Scanning the image to check for corruption.
  567.  
  568. if %family% EQU 8 (
  569.     Dism.exe /Online /Cleanup-Image /ScanHealth
  570. ) else if %family% EQU 10 (
  571.     Dism.exe /Online /Cleanup-Image /ScanHealth
  572. ) else (
  573.     echo.Sorry, this option is not available on this Operative System.
  574. )
  575.  
  576. echo.
  577. echo.Press any key to continue . . .
  578. pause>nul
  579. goto :eof
  580. :: /*************************************************************************************/
  581.  
  582.  
  583. :: Check the detected corruptions.
  584. :: /*************************************************************************************/
  585. :dism2
  586.  
  587. call :print Checking the detected corruptions.
  588.  
  589.  
  590. if %family% EQU 8 (
  591.     Dism.exe /Online /Cleanup-Image /CheckHealth
  592. ) else if %family% EQU 10 (
  593.     Dism.exe /Online /Cleanup-Image /CheckHealth
  594. ) else (
  595.     echo.Sorry, this option is not available on this Operative System.
  596. )
  597.  
  598. echo.
  599. echo.Press any key to continue . . .
  600. pause>nul
  601. goto :eof
  602. :: /*************************************************************************************/
  603.  
  604.  
  605. :: Repair the image.
  606. :: /*************************************************************************************/
  607. :dism3
  608.  
  609. call :print Repairing the image.
  610.  
  611. if %family% EQU 8 (
  612.     Dism.exe /Online /Cleanup-Image /RestoreHealth
  613. ) else if %family% EQU 10 (
  614.     Dism.exe /Online /Cleanup-Image /RestoreHealth
  615. ) else (
  616.     echo.Sorry, this option is not available on this Operative System.
  617. )
  618.  
  619. echo.
  620. echo.Press any key to continue . . .
  621. pause>nul
  622. goto :eof
  623. :: /*************************************************************************************/
  624.  
  625.  
  626. :: Clean up the superseded components .
  627. :: /*************************************************************************************/
  628. :dism4
  629.  
  630. call :print Clean up the superseded components.
  631.  
  632. if %family% EQU 8 (
  633.     Dism.exe /Online /Cleanup-Image /StartComponentCleanup
  634. ) else if %family% EQU 10 (
  635.     Dism.exe /Online /Cleanup-Image /StartComponentCleanup
  636. ) else (
  637.     echo.Sorry, this option is not available on this Operative System.
  638. )
  639.  
  640. echo.
  641. echo.Press any key to continue . . .
  642. pause>nul
  643. goto :eof
  644. :: /*************************************************************************************/
  645.  
  646.  
  647. :: Change invalid values.
  648. :: /*************************************************************************************/
  649. :regedit
  650.  
  651. for /f "tokens=1-5 delims=/, " %%a in ("%date%") do (
  652.     set now=%%a%%b%%c%%d%time:~0,2%%time:~3,2%
  653. )
  654.  
  655. :: ----- Create a backup of the Registry -----
  656. call :print Making a backup copy of the Registry in: %USERPROFILE%\Desktop\Backup%now%.reg
  657.  
  658. if exist "%USERPROFILE%\Desktop\Backup%now%.reg" (
  659.     echo.An unexpected error has occurred.
  660.     echo.
  661.     echo.    Changes were not carried out in the registry.
  662.     echo.    Will try it later.
  663.     echo.
  664.     echo.Press any key to continue . . .
  665.     pause>nul
  666.     goto :eof
  667. ) else (
  668.     regedit /e "%USERPROFILE%\Desktop\Backup%now%.reg"
  669. )
  670.  
  671. :: ----- Checking backup -----
  672. call :print Checking the backup copy.
  673.  
  674. if not exist "%USERPROFILE%\Desktop\Backup%now%.reg" (
  675.     echo.An unexpected error has occurred.
  676.     echo.
  677.     echo.    Something went wrong.
  678.     echo.    You manually create a backup of the registry before continuing.
  679.     echo.
  680.     echo.Press any key to continue . . .
  681.     pause>nul
  682. ) else (
  683.     echo.The operation completed successfully.
  684.     echo.
  685. )
  686.  
  687. :: ----- Delete keys in the Registry -----
  688. call :print Deleting values in the Registry.
  689.  
  690. reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
  691. reg delete "HKLM\COMPONENTS\PendingXmlIdentifier" /f
  692. reg delete "HKLM\COMPONENTS\NextQueueEntryIndex" /f
  693. reg delete "HKLM\COMPONENTS\AdvancedInstallersNeedResolving" /f
  694.  
  695. :: ----- Add keys in the Registry -----
  696. call :print Adding values in the Registry.
  697.  
  698. set key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
  699. call :addReg "%key%" "AppData" "REG_EXPAND_SZ" "%USERPROFILE%\AppData\Roaming"
  700.  
  701. set key=HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
  702. call :addReg "%key%" "AppData" "REG_EXPAND_SZ" "%USERPROFILE%\AppData\Roaming"
  703.  
  704. set key=HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
  705. call :addReg "%key%" "AppData" "REG_EXPAND_SZ" "%USERPROFILE%\AppData\Roaming"
  706.  
  707. set key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate
  708. call :addReg "%key%" "AllowOSUpgrade" "REG_DWORD" "1"
  709.  
  710. reg add "HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup" /f
  711.  
  712. set key=HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains
  713. call :addReg "%key%\microsoft.com\update" "http" "REG_DWORD" "2"
  714. call :addReg "%key%\microsoft.com\update" "https" "REG_DWORD" "2"
  715. call :addReg "%key%\microsoft.com\windowsupdate" "http" "REG_DWORD" "2"
  716. call :addReg "%key%\update.microsoft.com" "http" "REG_DWORD" "2"
  717. call :addReg "%key%\update.microsoft.com" "https" "REG_DWORD" "2"
  718. call :addReg "%key%\windowsupdate.com" "http" "REG_DWORD" "2"
  719. call :addReg "%key%\windowsupdate.microsoft.com" "http" "REG_DWORD" "2
  720. call :addReg "%key%\download.microsoft.com" "http" "REG_DWORD" "2"
  721. call :addReg "%key%\windowsupdate.com" "http" "REG_DWORD" "2"
  722. call :addReg "%key%\windowsupdate.com" "https" "REG_DWORD" "2"
  723. call :addReg "%key%\windowsupdate.com\download" "http" "REG_DWORD" "2"
  724. call :addReg "%key%\windowsupdate.com\download" "https" "REG_DWORD" "2"
  725. call :addReg "%key%\download.windowsupdate.com" "http" "REG_DWORD" "2"
  726. call :addReg "%key%\download.windowsupdate.com" "https" "REG_DWORD" "2"
  727. call :addReg "%key%\windows.com\wustat" "http" "REG_DWORD" "2"
  728. call :addReg "%key%\wustat.windows.com" "http" "REG_DWORD" "2"
  729. call :addReg "%key%\microsoft.com\ntservicepack" "http" "REG_DWORD" "2"
  730. call :addReg "%key%\ntservicepack.microsoft.com" "http" "REG_DWORD" "2"
  731. call :addReg "%key%\microsoft.com\ws" "http" "REG_DWORD" "2"
  732. call :addReg "%key%\microsoft.com\ws" "https" "REG_DWORD" "2"
  733. call :addReg "%key%\ws.microsoft.com" "http" "REG_DWORD" "2"
  734. call :addReg "%key%\ws.microsoft.com" "https" "REG_DWORD" "2"
  735.  
  736. :: ----- End process -----
  737. call :print The operation completed successfully.
  738.  
  739. echo.Press any key to continue . . .
  740. pause>nul
  741. goto :eof
  742. :: /*************************************************************************************/
  743.  
  744.  
  745. winsock
  746. :: Reset Winsock setting.
  747. :: /*************************************************************************************/
  748. :Winsock
  749.  
  750. :: ----- Reset Winsock control -----
  751. call :print Reset Winsock control.
  752.  
  753. call :print Restoring transaction logs.
  754. fsutil resource setautoreset true C:\
  755.  
  756. call :print Restoring TPC/IP.
  757. netsh int ip reset
  758.  
  759. call :print Restoring Winsock.
  760. netsh winsock reset
  761.  
  762. call :print Restoring default policy settings.
  763. netsh advfirewall reset
  764.  
  765. call :print Restoring the DNS cache.
  766. ipconfig /flushdns
  767.  
  768. call :print Restoring the Proxy.
  769. netsh winhttp reset proxy
  770.  
  771. :: ----- End process -----
  772. call :print The operation completed successfully.
  773.  
  774. echo.Press any key to continue . . .
  775. pause>nul
  776. goto :eof
  777. :: /*************************************************************************************/
  778.  
  779.  
  780. :: Search Updates.
  781. :: /*************************************************************************************/
  782. :updates
  783.  
  784. call :print Looking for updates.
  785.  
  786. echo.Wait . . .
  787. echo.
  788.  
  789. wuauclt /resetauthorization /detectnow
  790.  
  791. if %family% EQU 10 (
  792.     start ms-settings:windowsupdate
  793. ) else (
  794.     if %family% NEQ 5 (
  795.         start wuapp.exe
  796.     ) else (
  797.         echo.
  798.         echo.An unexpected error has occurred.
  799.         echo.
  800.         echo.Press any key to continue . . .
  801.         pause>nul
  802.     )
  803. )
  804.  
  805. goto :eof
  806. :: /*************************************************************************************/
  807.  
  808.  
  809. :: Explore other local solutions.
  810. :: /*************************************************************************************/
  811. :local
  812.  
  813. call :print Looking for solutions in this PC.
  814.  
  815. if %family% NEQ 5 (
  816.     start control.exe /name Microsoft.Troubleshooting
  817. ) else (
  818.     echo.Sorry, this option is not available on this Operative System.
  819.     echo.
  820.     echo.Press any key to continue . . .
  821.     pause>nul
  822. )
  823.  
  824. goto :eof
  825. :: /*************************************************************************************/
  826.  
  827.  
  828. :: Explore other online solutions.
  829. :: /*************************************************************************************/
  830. :online
  831.  
  832. call :print Looking for solutions Online.
  833.  
  834. start https://support.microsoft.com/en-us/gp/windows-update-issues/
  835.  
  836. goto :eof
  837. :: /*************************************************************************************/
  838.  
  839.  
  840. :: Reboot the system.
  841. :: /*************************************************************************************/
  842. :restart
  843.  
  844. call :print Restart your PC.
  845.  
  846. if %family% NEQ 5 (
  847.     echo.    The system reboot in 60 seconds.
  848.     echo.    Please save all open documents.
  849.  
  850.     start shutdown.exe /r /t 60 /c "The system reboot in 60 seconds. Please save all open documents."
  851. ) else (
  852.     echo.Sorry, this option is not available on this Operative System.
  853. )
  854.  
  855. echo.
  856. echo.Press any key to continue . . .
  857. pause>nul
  858. goto :eof
  859. :: /*************************************************************************************/
  860.  
  861.  
  862. :: Crea el menú de descarga de diagnósticos.
  863. :: /*************************************************************************************/
  864. :diagnostic
  865.  
  866. call :print Download and run diagnostics for your system.
  867.  
  868. echo.    1. Windows Update on Windows 7, Windows 8 y Windows 8.1.
  869. echo.    2. Windows Update on Windows 10.
  870. echo.    3. Apps on Windows 8.1.
  871. echo.    4. Apps on Windows 10.
  872. echo.    5. Start Menu on Windows 10.
  873. echo.
  874.  
  875. set /p opcion=Seleccione una opci¢n:
  876.  
  877. if %opcion% EQU 1 (
  878.     start http://go.microsoft.com/?linkid=9830262
  879. ) else if %opcion% EQU 2 (
  880.     start http://aka.ms/diag_wu
  881. ) else if %opcion% EQU 3 (
  882.     start http://go.microsoft.com/fwlink/p/?LinkId=268423
  883. ) else if %opcion% EQU 4 (
  884.     start http://aka.ms/diag_apps10
  885. ) else if %opcion% EQU 5 (
  886.     start http://aka.ms/startmenuTS
  887. ) else (
  888.     echo.
  889.     echo.Invalid option.
  890.     echo.
  891.     echo.Press any key to continue . . .
  892.     pause>nul
  893. )
  894.  
  895. goto menu
  896. :: /*************************************************************************************/
  897.  
  898.  
  899. :: Open help file.
  900. :: /*************************************************************************************/
  901. :help
  902.  
  903. start %~dp0Help.chm
  904.  
  905. goto :eof
  906. :: /*************************************************************************************/
  907.  
  908.  
  909. :: End tool.
  910. :: /*************************************************************************************/
  911. :close
  912.  
  913. exit
  914. :: /*************************************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement