├── LICENSE
├── README.md
└── ResetWUEng.cmd
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Manuel Gil
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Reset Windows Update Tool (Script)
2 |
3 |
8 |
9 |
10 | []()
11 |
12 | ⚠ Deprecated! See [wureset-tools/script-wureset](https://github.com/wureset-tools/script-wureset)
13 |
14 | The Reset Windows Update Tool is a powerful troubleshooting tool designed to help users fix various issues related to Windows updates. This tool provides a wide range of functions to help reset and repair various components of the Windows Update service, as well as address other common system issues.
15 |
16 | ## Features
17 |
18 | The Reset Windows Update Tool provides the following features:
19 |
20 | - Resetting Windows Update components to their default settings
21 | - Deleting temporary files to free up disk space
22 | - Changing invalid values in the Windows Registry to ensure smooth operation
23 | - Scanning and repairing protected system files that may be corrupted using the "sfc /scannow" command
24 | - Detecting and repairing corruptions in the Windows system image
25 | - Cleaning up superseded components to optimize system performance and free up disk space
26 |
27 | ## Getting Started
28 |
29 | To use the Reset Windows Update Tool, simply download the tool and run it on your Windows system. The tool will guide you through the process of resetting and repairing various components of the Windows Update service, as well as other common system issues.
30 |
31 | ## Support
32 |
33 | - Wiki: [:us:] [:es:] [:it:] [:brazil:] [:fr:] [:de:]
34 |
35 | ## Version list
36 |
37 | The following table lists version numbers:
38 |
39 | | Version | Date | Milestone |
40 | |:---|:---:|:---|
41 | | **10.5.5** | 24/03/2023 | Migration to [@wureset-tools](https://github.com/wureset-tools) |
42 | | **10.5.4.1** | 11/02/2020 | 5 Years Celebration |
43 | | **10.5.3.7** | 06/04/2019 | |
44 | | **10.5.3.6** | 06/07/2018 | +500K Downloads Celebration |
45 | | **10.5.3.5** | 12/22/2017 | |
46 | | **10.5.3.4** | 11/27/2017 | |
47 | | **10.5.3.3** | 07/23/2017 | |
48 |
49 |
50 | ## Credits
51 |
52 | This project is developed and maintained by [Manuel Gil](https://github.com/ManuelGil).
53 |
54 | ## License
55 |
56 | Reset Windows Update Tool (Script) is licensed under the MIT License - see the [MIT License](https://opensource.org/licenses/MIT) for details.
57 |
58 | [:us:]: https://github.com/ManuelGil/Reset-Windows-Update-Tool/wiki
59 | [:es:]: https://github.com/ManuelGil/Reset-Windows-Update-Tool/wiki/Home-%5Bes%5D
60 | [:it:]: https://github.com/ManuelGil/Reset-Windows-Update-Tool/wiki/Home-%5Bit%5D
61 | [:brazil:]: https://github.com/ManuelGil/Reset-Windows-Update-Tool/wiki/Home-%5Bbr%5D
62 | [:fr:]: https://github.com/ManuelGil/Reset-Windows-Update-Tool/wiki/Home-%5Bfr%5D
63 | [:de:]: https://github.com/ManuelGil/Reset-Windows-Update-Tool/wiki/Home-%5Bde%5D
64 |
--------------------------------------------------------------------------------
/ResetWUEng.cmd:
--------------------------------------------------------------------------------
1 | :: ==================================================================================
2 | :: NAME: Reset Windows Update Tool.
3 | :: DESCRIPTION: This script reset the Windows Update Components.
4 | :: AUTHOR: Manuel Gil.
5 | :: VERSION: 10.5.4.1 - Date: 11/02/2020
6 | :: ==================================================================================
7 |
8 |
9 | :: Set console.
10 | :: void mode();
11 | :: /************************************************************************************/
12 | :mode
13 | echo off
14 | title Reset Windows Update Tool.
15 | mode con cols=90 lines=36
16 | color 17
17 | cls
18 |
19 | goto getValues
20 | goto :eof
21 | :: /************************************************************************************/
22 |
23 |
24 | :: Print Top Text.
25 | :: @param - text = the text to print (%*).
26 | :: void print(string text);
27 | :: /*************************************************************************************/
28 | :print
29 | cls
30 | echo.
31 | echo.%name% [Version: %version%]
32 | echo.Reset Windows Update Tool.
33 | echo.
34 | echo.%*
35 | echo.
36 | goto :eof
37 | :: /*************************************************************************************/
38 |
39 |
40 | :: Add Value in the Registry.
41 | :: @param - key = the key or entry to be added (%~1).
42 | :: value = the value to be added under the selected key (%~2).
43 | :: type = the type for the registry entry (%~3).
44 | :: data = the data for the new registry entry (%~4).
45 | :: void addReg(string key, string value, string type, string data);
46 | :: /*************************************************************************************/
47 | :addReg
48 | reg add "%~1" /v "%~2" /t "%~3" /d "%~4" /f
49 | goto :eof
50 | :: /*************************************************************************************/
51 |
52 |
53 | :: Load the system values.
54 | :: void getValues();
55 | :: /************************************************************************************/
56 | :getValues
57 | for /f "tokens=4 delims=[] " %%a in ('ver') do set version=%%a
58 |
59 | if %version% EQU 6.0.6000 (
60 | :: Name: "Microsoft Windows Vista"
61 | set name=Microsoft Windows Vista
62 | :: Family: Windows 6
63 | set family=6
64 | :: Compatibility: No
65 | set allow=No
66 | ) else if %version% EQU 6.0.6001 (
67 | :: Name: "Microsoft Windows Vista SP1"
68 | set name=Microsoft Windows Vista SP1
69 | :: Family: Windows 6
70 | set family=6
71 | :: Compatibility: No
72 | set allow=No
73 | ) else if %version% EQU 6.0.6002 (
74 | :: Name: "Microsoft Windows Vista SP2"
75 | set name=Microsoft Windows Vista SP2
76 | :: Family: Windows 6
77 | set family=6
78 | :: Compatibility: No
79 | set allow=No
80 | ) else if %version% EQU 6.1.7600 (
81 | :: Name: "Microsoft Windows 7"
82 | set name=Microsoft Windows 7
83 | :: Family: Windows 7
84 | set family=7
85 | :: Compatibility: No
86 | set allow=No
87 | ) else if %version% EQU 6.1.7601 (
88 | :: Name: "Microsoft Windows 7 SP1"
89 | set name=Microsoft Windows 7 SP1
90 | :: Family: Windows 7
91 | set family=7
92 | :: Compatibility: No
93 | set allow=No
94 | ) else if %version% EQU 6.2.9200 (
95 | :: Name: "Microsoft Windows 8"
96 | set name=Microsoft Windows 8
97 | :: Family: Windows 8
98 | set family=8
99 | :: Compatibility: Yes
100 | set allow=Yes
101 | ) else if %version% EQU 6.3.9200 (
102 | :: Name: "Microsoft Windows 8.1"
103 | set name=Microsoft Windows 8.1
104 | :: Family: Windows 8
105 | set family=8
106 | :: Compatibility: Yes
107 | set allow=Yes
108 | ) else if %version% EQU 6.3.9600 (
109 | :: Name: "Microsoft Windows 8.1 Update 1"
110 | set name=Microsoft Windows 8.1 Update 1
111 | :: Family: Windows 8
112 | set family=8
113 | :: Compatibility: Yes
114 | set allow=Yes
115 | ) else (
116 | ver | find "10.0." > nul
117 | if %errorlevel% EQU 0 (
118 | :: Name: "Microsoft Windows 10"
119 | set name=Microsoft Windows 10
120 | :: Family: Windows 10
121 | set family=10
122 | :: Compatibility: Yes
123 | set allow=Yes
124 | ) else (
125 | :: Name: "Unknown"
126 | set name=Unknown
127 | :: Compatibility: No
128 | set allow=No
129 | )
130 | )
131 |
132 | call :print %name% detected . . .
133 |
134 | if %allow% EQU Yes goto permission
135 |
136 | call :print Sorry, this Operative System is not compatible with this tool.
137 |
138 | echo. An error occurred while attempting to verify your system.
139 | echo. Can this using a business or test version.
140 | echo.
141 | echo. if not, verify that your system has the correct security fix.
142 |
143 | echo.
144 |
145 | echo.Press any key to continue . . .
146 | pause>nul
147 | goto :eof
148 | :: /************************************************************************************/
149 |
150 |
151 | :: Checking for Administrator elevation.
152 | :: void permission();
153 | :: /************************************************************************************/
154 | :permission
155 | openfiles>nul 2>&1
156 |
157 | if %errorlevel% EQU 0 goto terms
158 |
159 | call :print Checking for Administrator elevation.
160 |
161 | echo. You are not running as Administrator.
162 | echo. This tool cannot do it's job without elevation.
163 | echo.
164 | echo. You need run this tool as Administrator.
165 | echo.
166 |
167 | echo.Press any key to continue . . .
168 | pause>nul
169 | goto :eof
170 | :: /************************************************************************************/
171 |
172 |
173 | :: Terms.
174 | :: void terms();
175 | :: /*************************************************************************************/
176 | :terms
177 | call :print Terms and Conditions of Use.
178 |
179 | echo. The methods inside this tool modify files and registry settings.
180 | echo. While you are tested and tend to work, We not take responsibility for
181 | echo. the use of this tool.
182 | echo.
183 | echo. This tool is provided without warranty. Any damage caused is your
184 | echo. own responsibility.
185 | echo.
186 | echo. As well, batch files are almost always flagged by anti-virus, feel free
187 | echo. to review the code if you're unsure.
188 | echo.
189 |
190 | choice /c YN /n /m "Do you want to continue with this process? (Y/N) "
191 | if %errorlevel% EQU 1 (
192 | goto menu
193 | ) else if %errorlevel% EQU 2 (
194 | goto close
195 | ) else if %errorlevel% EQU 9009 (
196 | echo.
197 | echo.An unexpected error has occurred.
198 | echo.
199 | echo.Press any key to continue . . .
200 | pause>nul
201 | goto menu
202 | )
203 | goto :eof
204 | :: /*************************************************************************************/
205 |
206 |
207 | :: Menu of tool.
208 | :: void menu();
209 | :: /*************************************************************************************/
210 | :menu
211 | call :print This tool reset the Windows Update Components.
212 |
213 | echo. 1. Opens the system protection.
214 | echo. 2. Resets the Windows Update Components.
215 | echo. 3. Deletes the temporary files in Windows.
216 | echo. 4. Opens the Internet Explorer options.
217 | echo. 5. Runs Chkdsk on the Windows partition.
218 | echo. 6. Runs the System File Checker tool.
219 | echo. 7. Scans the image for component store corruption.
220 | echo. 8. Checks whether the image has been flagged as corrupted.
221 | echo. 9. Performs repair operations automatically.
222 | echo. 10. Cleans up the superseded components.
223 | echo. 11. Deletes any incorrect registry values.
224 | echo. 12. Repairs/Resets Winsock settings.
225 | echo. 13. Forces Group Policy Update.
226 | echo. 14. Searches Windows updates.
227 | echo. 15. Resets the Windows Store.
228 | echo. 16. Finds the Windows Product Key.
229 | echo. 17. Explores other local solutions.
230 | echo. 18. Explores other online solutions.
231 | echo. 19. Downloads the Diagnostic Tools.
232 | echo. 20. Restarts your PC.
233 | echo.
234 | echo. ?. Help. 0. Close.
235 | echo.
236 |
237 | set /p option=Select an option:
238 |
239 | if %option% EQU 0 (
240 | goto close
241 | ) else if %option% EQU 1 (
242 | call :sysProtection
243 | ) else if %option% EQU 2 (
244 | call :components
245 | ) else if %option% EQU 3 (
246 | call :temp
247 | ) else if %option% EQU 4 (
248 | call :iOptions
249 | ) else if %option% EQU 5 (
250 | call :chkdsk
251 | ) else if %option% EQU 6 (
252 | call :sfc
253 | ) else if %option% EQU 7 (
254 | call :dism1
255 | ) else if %option% EQU 8 (
256 | call :dism2
257 | ) else if %option% EQU 9 (
258 | call :dism3
259 | ) else if %option% EQU 10 (
260 | call :dism4
261 | ) else if %option% EQU 11 (
262 | call :regedit
263 | ) else if %option% EQU 12 (
264 | call :winsock
265 | ) else if %option% EQU 13 (
266 | call :gpupdate
267 | ) else if %option% EQU 14 (
268 | call :updates
269 | ) else if %option% EQU 15 (
270 | call :wsreset
271 | ) else if %option% EQU 16 (
272 | call :productKey
273 | ) else if %option% EQU 17 (
274 | call :local
275 | ) else if %option% EQU 18 (
276 | call :online
277 | ) else if %option% EQU 19 (
278 | call :diagnostic
279 | ) else if %option% EQU 20 (
280 | call :restart
281 | ) else if %option% EQU ? (
282 | call :help
283 | ) else (
284 | echo.
285 | echo.Invalid option.
286 | echo.
287 | echo.Press any key to continue . . .
288 | pause>nul
289 | )
290 |
291 | goto menu
292 | goto :eof
293 | :: /*************************************************************************************/
294 |
295 |
296 | :: Open system protection.
297 | :: void sysProtection();
298 | :: /*************************************************************************************/
299 | :sysProtection
300 | call :print Opening the system protection.
301 |
302 | if %family% NEQ 5 (
303 | start systempropertiesprotection
304 | ) else (
305 | echo.
306 | echo.Sorry, this option is not available on this Operative System.
307 | echo.
308 | echo.Press any key to continue . . .
309 | pause>nul
310 | )
311 | goto :eof
312 | :: /*************************************************************************************/
313 |
314 |
315 | :: Run the reset Windows Update components.
316 | :: void components();
317 | :: /*************************************************************************************/
318 | :components
319 | :: ----- Stopping the Windows Update services -----
320 | call :print Stopping the Windows Update services.
321 | net stop bits
322 |
323 | call :print Stopping the Windows Update services.
324 | net stop wuauserv
325 |
326 | call :print Stopping the Windows Update services.
327 | net stop appidsvc
328 |
329 | call :print Stopping the Windows Update services.
330 | net stop cryptsvc
331 |
332 | call :print Canceling the Windows Update process.
333 | taskkill /im wuauclt.exe /f
334 |
335 | :: ----- Checking the services status -----
336 | call :print Checking the services status.
337 |
338 | sc query bits | findstr /I /C:"STOPPED"
339 | if %errorlevel% NEQ 0 (
340 | echo. Failed to stop the BITS service.
341 | echo.
342 | echo.Press any key to continue . . .
343 | pause>nul
344 | goto :eof
345 | )
346 |
347 | call :print Checking the services status.
348 |
349 | sc query wuauserv | findstr /I /C:"STOPPED"
350 | if %errorlevel% NEQ 0 (
351 | echo. Failed to stop the Windows Update service.
352 | echo.
353 | echo.Press any key to continue . . .
354 | pause>nul
355 | goto :eof
356 | )
357 |
358 | call :print Checking the services status.
359 |
360 | sc query appidsvc | findstr /I /C:"STOPPED"
361 | if %errorlevel% NEQ 0 (
362 | sc query appidsvc | findstr /I /C:"OpenService FAILED 1060"
363 | if %errorlevel% NEQ 0 (
364 | echo. Failed to stop the Application Identity service.
365 | echo.
366 | echo.Press any key to continue . . .
367 | pause>nul
368 | if %family% NEQ 6 goto :eof
369 | )
370 | )
371 |
372 | call :print Checking the services status.
373 |
374 | sc query cryptsvc | findstr /I /C:"STOPPED"
375 | if %errorlevel% NEQ 0 (
376 | echo. Failed to stop the Cryptographic Services service.
377 | echo.
378 | echo.Press any key to continue . . .
379 | pause>nul
380 | goto :eof
381 | )
382 |
383 | :: ----- Delete the qmgr*.dat files -----
384 | call :print Deleting the qmgr*.dat files.
385 |
386 | del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
387 | del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat"
388 |
389 | :: ----- Renaming the softare distribution folders backup copies -----
390 | call :print Deleting the old software distribution backup copies.
391 |
392 | cd /d %SYSTEMROOT%
393 |
394 | if exist "%SYSTEMROOT%\winsxs\pending.xml.bak" (
395 | del /s /q /f "%SYSTEMROOT%\winsxs\pending.xml.bak"
396 | )
397 | if exist "%SYSTEMROOT%\SoftwareDistribution.bak" (
398 | rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution.bak"
399 | )
400 | if exist "%SYSTEMROOT%\system32\Catroot2.bak" (
401 | rmdir /s /q "%SYSTEMROOT%\system32\Catroot2.bak"
402 | )
403 | if exist "%SYSTEMROOT%\WindowsUpdate.log.bak" (
404 | del /s /q /f "%SYSTEMROOT%\WindowsUpdate.log.bak"
405 | )
406 |
407 | call :print Renaming the software distribution folders.
408 |
409 | if exist "%SYSTEMROOT%\winsxs\pending.xml" (
410 | takeown /f "%SYSTEMROOT%\winsxs\pending.xml"
411 | attrib -r -s -h /s /d "%SYSTEMROOT%\winsxs\pending.xml"
412 | ren "%SYSTEMROOT%\winsxs\pending.xml" pending.xml.bak
413 | )
414 | if exist "%SYSTEMROOT%\SoftwareDistribution" (
415 | attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution"
416 | ren "%SYSTEMROOT%\SoftwareDistribution" SoftwareDistribution.bak
417 | if exist "%SYSTEMROOT%\SoftwareDistribution" (
418 | echo.
419 | echo. Failed to rename the SoftwareDistribution folder.
420 | echo.
421 | echo.Press any key to continue . . .
422 | pause>nul
423 | goto :eof
424 | )
425 | )
426 | if exist "%SYSTEMROOT%\system32\Catroot2" (
427 | attrib -r -s -h /s /d "%SYSTEMROOT%\system32\Catroot2"
428 | ren "%SYSTEMROOT%\system32\Catroot2" Catroot2.bak
429 | )
430 | if exist "%SYSTEMROOT%\WindowsUpdate.log" (
431 | attrib -r -s -h /s /d "%SYSTEMROOT%\WindowsUpdate.log"
432 | ren "%SYSTEMROOT%\WindowsUpdate.log" WindowsUpdate.log.bak
433 | )
434 |
435 | :: ----- Reset the BITS service and the Windows Update service to the default security descriptor -----
436 | call :print Reset the BITS service and the Windows Update service to the default security descriptor.
437 |
438 | sc.exe sdset wuauserv D:(A;CI;CCLCSWRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOSDRCWDWO;;;WD)
439 | sc.exe sdset bits D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;SAFA;WDWO;;;BA)
440 | sc.exe sdset cryptsvc D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CCLCSWRPWPDTLOCRRC;;;SO)(A;;CCLCSWLORC;;;AC)(A;;CCLCSWLORC;;;S-1-15-3-1024-3203351429-2120443784-2872670797-1918958302-2829055647-4275794519-765664414-2751773334)
441 | sc.exe sdset trustedinstaller D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRRC;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;SAFA;WDWO;;;BA)
442 |
443 | :: ----- Reregister the BITS files and the Windows Update files -----
444 | call :print Reregister the BITS files and the Windows Update files.
445 |
446 | cd /d %SYSTEMROOT%\system32
447 | regsvr32.exe /s atl.dll
448 | regsvr32.exe /s urlmon.dll
449 | regsvr32.exe /s mshtml.dll
450 | regsvr32.exe /s shdocvw.dll
451 | regsvr32.exe /s browseui.dll
452 | regsvr32.exe /s jscript.dll
453 | regsvr32.exe /s vbscript.dll
454 | regsvr32.exe /s scrrun.dll
455 | regsvr32.exe /s msxml.dll
456 | regsvr32.exe /s msxml3.dll
457 | regsvr32.exe /s msxml6.dll
458 | regsvr32.exe /s actxprxy.dll
459 | regsvr32.exe /s softpub.dll
460 | regsvr32.exe /s wintrust.dll
461 | regsvr32.exe /s dssenh.dll
462 | regsvr32.exe /s rsaenh.dll
463 | regsvr32.exe /s gpkcsp.dll
464 | regsvr32.exe /s sccbase.dll
465 | regsvr32.exe /s slbcsp.dll
466 | regsvr32.exe /s cryptdlg.dll
467 | regsvr32.exe /s oleaut32.dll
468 | regsvr32.exe /s ole32.dll
469 | regsvr32.exe /s shell32.dll
470 | regsvr32.exe /s initpki.dll
471 | regsvr32.exe /s wuapi.dll
472 | regsvr32.exe /s wuaueng.dll
473 | regsvr32.exe /s wuaueng1.dll
474 | regsvr32.exe /s wucltui.dll
475 | regsvr32.exe /s wups.dll
476 | regsvr32.exe /s wups2.dll
477 | regsvr32.exe /s wuweb.dll
478 | regsvr32.exe /s qmgr.dll
479 | regsvr32.exe /s qmgrprxy.dll
480 | regsvr32.exe /s wucltux.dll
481 | regsvr32.exe /s muweb.dll
482 | regsvr32.exe /s wuwebv.dll
483 |
484 | :: ----- Resetting Winsock -----
485 | call :print Resetting Winsock.
486 | netsh winsock reset
487 |
488 | :: ----- Resetting WinHTTP Proxy -----
489 | call :print Resetting WinHTTP Proxy.
490 |
491 | if %family% EQU 5 (
492 | proxycfg.exe -d
493 | ) else (
494 | netsh winhttp reset proxy
495 | )
496 |
497 | :: ----- Set the startup type as automatic -----
498 | call :print Resetting the services as automatics.
499 | sc.exe config wuauserv start= auto
500 | sc.exe config bits start= delayed-auto
501 | sc.exe config cryptsvc start= auto
502 | sc.exe config TrustedInstaller start= demand
503 | sc.exe config DcomLaunch start= auto
504 |
505 | :: ----- Starting the Windows Update services -----
506 | call :print Starting the Windows Update services.
507 | net start bits
508 |
509 | call :print Starting the Windows Update services.
510 | net start wuauserv
511 |
512 | call :print Starting the Windows Update services.
513 | net start appidsvc
514 |
515 | call :print Starting the Windows Update services.
516 | net start cryptsvc
517 |
518 | call :print Starting the Windows Update services.
519 | net start DcomLaunch
520 |
521 | :: ----- End process -----
522 | call :print The operation completed successfully.
523 |
524 | echo.Press any key to continue . . .
525 | pause>nul
526 | goto :eof
527 | :: /*************************************************************************************/
528 |
529 |
530 | :: Delete temporary files in Windows.
531 | :: void temp();
532 | :: /*************************************************************************************/
533 | :temp
534 | call :print Deleting the temporary files in Windows.
535 |
536 | del /s /f /q "%TEMP%\*.*"
537 | del /s /f /q "%SYSTEMROOT%\Temp\*.*"
538 |
539 | echo.
540 | echo.Press any key to continue . . .
541 | pause>nul
542 | goto :eof
543 | :: /*************************************************************************************/
544 |
545 |
546 | :: Open the Internet Explorer options.
547 | :: void iOptions();
548 | :: /*************************************************************************************/
549 | :iOptions
550 | call :print Opening the Internet Explorer options.
551 |
552 | start InetCpl.cpl
553 | goto :eof
554 | :: /*************************************************************************************/
555 |
556 |
557 | :: Check and repair errors on the disk.
558 | :: void chkdsk();
559 | :: /*************************************************************************************/
560 | :chkdsk
561 | call :print Check the file system and file system metadata of a volume for logical and physical errors (CHKDSK.exe).
562 |
563 | chkdsk %SYSTEMDRIVE% /f /r
564 |
565 | if %errorlevel% EQU 0 (
566 | echo.
567 | echo.The operation completed successfully.
568 | ) else (
569 | echo.
570 | echo.An error occurred during operation.
571 | )
572 |
573 | echo.
574 | echo.Press any key to continue . . .
575 | pause>nul
576 | goto :eof
577 | :: /*************************************************************************************/
578 |
579 |
580 | :: Scans all protected system files.
581 | :: void sfc();
582 | :: /*************************************************************************************/
583 | :sfc
584 | call :print Scan your system files and to repair missing or corrupted system files (SFC.exe).
585 |
586 | if %family% NEQ 5 (
587 | sfc /scannow
588 | ) else (
589 | echo.Sorry, this option is not available on this Operative System.
590 | )
591 |
592 | if %errorlevel% EQU 0 (
593 | echo.
594 | echo.The operation completed successfully.
595 | ) else (
596 | echo.
597 | echo.An error occurred during operation.
598 | )
599 |
600 | echo.
601 | echo.Press any key to continue . . .
602 | pause>nul
603 | goto :eof
604 | :: /*************************************************************************************/
605 |
606 |
607 | :: Scan the image to check for corruption.
608 | :: void dism1();
609 | :: /*************************************************************************************/
610 | :dism1
611 | call :print Scan the image for component store corruption (The DISM /ScanHealth argument).
612 |
613 | if %family% EQU 8 (
614 | Dism.exe /Online /Cleanup-Image /ScanHealth
615 | ) else if %family% EQU 10 (
616 | Dism.exe /Online /Cleanup-Image /ScanHealth
617 | ) else (
618 | echo.Sorry, this option is not available on this Operative System.
619 | )
620 |
621 | if %errorlevel% EQU 0 (
622 | echo.
623 | echo.The operation completed successfully.
624 | ) else (
625 | echo.
626 | echo.An error occurred during operation.
627 | )
628 |
629 | echo.
630 | echo.Press any key to continue . . .
631 | pause>nul
632 | goto :eof
633 | :: /*************************************************************************************/
634 |
635 |
636 | :: Check the detected corruptions.
637 | :: void dism2();
638 | :: /*************************************************************************************/
639 | :dism2
640 | call :print Check whether the image has been flagged as corrupted by a failed process and whether the corruption can be repaired (The DISM /CheckHealth argument).
641 |
642 | if %family% EQU 8 (
643 | Dism.exe /Online /Cleanup-Image /CheckHealth
644 | ) else if %family% EQU 10 (
645 | Dism.exe /Online /Cleanup-Image /CheckHealth
646 | ) else (
647 | echo.Sorry, this option is not available on this Operative System.
648 | )
649 |
650 | if %errorlevel% EQU 0 (
651 | echo.
652 | echo.The operation completed successfully.
653 | ) else (
654 | echo.
655 | echo.An error occurred during operation.
656 | )
657 |
658 | echo.
659 | echo.Press any key to continue . . .
660 | pause>nul
661 | goto :eof
662 | :: /*************************************************************************************/
663 |
664 |
665 | :: Repair the Windows image.
666 | :: void dism3();
667 | :: /*************************************************************************************/
668 | :dism3
669 | call :print Scan the image for component store corruption, and then perform repair operations automatically (The DISM /RestoreHealth argument).
670 |
671 | if %family% EQU 8 (
672 | Dism.exe /Online /Cleanup-Image /RestoreHealth
673 | ) else if %family% EQU 10 (
674 | Dism.exe /Online /Cleanup-Image /RestoreHealth
675 | ) else (
676 | echo.Sorry, this option is not available on this Operative System.
677 | )
678 |
679 | if %errorlevel% EQU 0 (
680 | echo.
681 | echo.The operation completed successfully.
682 | ) else (
683 | echo.
684 | echo.An error occurred during operation.
685 | )
686 |
687 | echo.
688 | echo.Press any key to continue . . .
689 | pause>nul
690 | goto :eof
691 | :: /*************************************************************************************/
692 |
693 |
694 | :: Clean up the superseded components.
695 | :: void dism4();
696 | :: /*************************************************************************************/
697 | :dism4
698 | call :print Clean up the superseded components and reduce the size of the component store (The DISM /StartComponentCleanup argument).
699 |
700 | if %family% EQU 8 (
701 | Dism.exe /Online /Cleanup-Image /StartComponentCleanup
702 | ) else if %family% EQU 10 (
703 | Dism.exe /Online /Cleanup-Image /StartComponentCleanup
704 | ) else (
705 | echo.Sorry, this option is not available on this Operative System.
706 | )
707 |
708 | if %errorlevel% EQU 0 (
709 | echo.
710 | echo.The operation completed successfully.
711 | ) else (
712 | echo.
713 | echo.An error occurred during operation.
714 | )
715 |
716 | echo.
717 | echo.Press any key to continue . . .
718 | pause>nul
719 | goto :eof
720 | :: /*************************************************************************************/
721 |
722 |
723 | :: Change invalid values.
724 | :: void regedit();
725 | :: /*************************************************************************************/
726 | :regedit
727 | for /f "tokens=1-5 delims=/., " %%a in ("%date%") do (
728 | set now=%%a%%b%%c%%d%time:~0,2%%time:~3,2%
729 | )
730 |
731 | if not exist "%USERPROFILE%\Desktop\Backup\Regedit\%now%\" (
732 | mkdir "%USERPROFILE%\Desktop\Backup\Regedit\%now%\"
733 | )
734 |
735 | :: ----- Create a backup of the Registry -----
736 | call :print Making a backup of the Registry in: %USERPROFILE%\Desktop\Backup\Regedit\%now%\
737 |
738 | if exist "%USERPROFILE%\Desktop\Backup\Regedit\%now%\HKLM.reg" (
739 | echo.An unexpected error has occurred.
740 | echo.
741 | echo. Changes were not carried out in the registry.
742 | echo. Will try it later.
743 | echo.
744 | echo.Press any key to continue . . .
745 | pause>nul
746 | goto :eof
747 | ) else (
748 | reg Export HKCR "%USERPROFILE%\Desktop\Backup\Regedit\%now%\HKCR.reg"
749 | reg Export HKCU "%USERPROFILE%\Desktop\Backup\Regedit\%now%\HKCU.reg"
750 | reg Export HKLM "%USERPROFILE%\Desktop\Backup\Regedit\%now%\HKLM.reg"
751 | reg Export HKU "%USERPROFILE%\Desktop\Backup\Regedit\%now%\HKU.reg"
752 | reg Export HKCC "%USERPROFILE%\Desktop\Backup\Regedit\%now%\HKCC.reg"
753 | )
754 |
755 | :: ----- Checking backup -----
756 | call :print Checking the backup.
757 |
758 | if not exist "%USERPROFILE%\Desktop\Backup\Regedit\%now%\HKLM.reg" (
759 | echo.An unexpected error has occurred.
760 | echo.
761 | echo. Something went wrong.
762 | echo. You manually create a backup of the registry before continuing.
763 | echo.
764 | echo.Press any key to continue . . .
765 | pause>nul
766 | ) else (
767 | echo.The operation completed successfully.
768 | echo.
769 | )
770 |
771 | :: ----- Delete keys in the Registry -----
772 | call :print Deleting values in the Registry.
773 |
774 | reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /f
775 | reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f
776 | reg delete "HKCU\Software\Microsoft\WindowsSelfHost" /f
777 | reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /f
778 | reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /f
779 | reg delete "HKLM\Software\Microsoft\WindowsSelfHost" /f
780 | reg delete "HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /f
781 |
782 | reg delete "HKLM\COMPONENTS\PendingXmlIdentifier" /f
783 | reg delete "HKLM\COMPONENTS\NextQueueEntryIndex" /f
784 | reg delete "HKLM\COMPONENTS\AdvancedInstallersNeedResolving" /f
785 | reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
786 |
787 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v ResetClient /f
788 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v ResetDataStoreReason /f
789 |
790 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
791 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
792 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f
793 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientIDValidation /f
794 |
795 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUState /f
796 |
797 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v LastWaitTimeout /f
798 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v DetectionstartTime /f
799 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v NextDetectionTime /f
800 |
801 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" /f
802 |
803 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results" /f
804 |
805 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Reporting" /v SamplingValue /f
806 | reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services" /v ReregisterAuthorizationCab /f
807 |
808 | :: ----- Add keys in the Registry -----
809 | call :print Adding values in the Registry.
810 |
811 | set key=HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX
812 | call :addReg "%key%" "IsConvergedUpdateStackEnabled" "REG_DWORD" "0"
813 |
814 | set key=HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings
815 | call :addReg "%key%" "UxOption" "REG_DWORD" "0"
816 |
817 | set key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
818 | call :addReg "%key%" "AppData" "REG_EXPAND_SZ" "%USERPROFILE%\AppData\Roaming"
819 |
820 | set key=HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
821 | call :addReg "%key%" "AppData" "REG_EXPAND_SZ" "%USERPROFILE%\AppData\Roaming"
822 |
823 | set key=HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
824 | call :addReg "%key%" "AppData" "REG_EXPAND_SZ" "%USERPROFILE%\AppData\Roaming"
825 |
826 | reg add "HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup" /f
827 |
828 | reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v Security_HKLM_only | find /i "Security_HKLM_Only" | find "1"
829 |
830 | if %errorlevel% EQU 0 (
831 | set key=HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains
832 | ) else (
833 | set key=HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains
834 | )
835 |
836 | call :addReg "%key%\microsoft.com\update" "http" "REG_DWORD" "2"
837 | call :addReg "%key%\microsoft.com\update" "https" "REG_DWORD" "2"
838 | call :addReg "%key%\microsoft.com\windowsupdate" "http" "REG_DWORD" "2"
839 | call :addReg "%key%\update.microsoft.com" "http" "REG_DWORD" "2"
840 | call :addReg "%key%\update.microsoft.com" "https" "REG_DWORD" "2"
841 | call :addReg "%key%\windowsupdate.com" "http" "REG_DWORD" "2"
842 | call :addReg "%key%\windowsupdate.microsoft.com" "http" "REG_DWORD" "2"
843 | call :addReg "%key%\download.microsoft.com" "http" "REG_DWORD" "2"
844 | call :addReg "%key%\windowsupdate.com" "http" "REG_DWORD" "2"
845 | call :addReg "%key%\windowsupdate.com" "https" "REG_DWORD" "2"
846 | call :addReg "%key%\windowsupdate.com\download" "http" "REG_DWORD" "2"
847 | call :addReg "%key%\windowsupdate.com\download" "https" "REG_DWORD" "2"
848 | call :addReg "%key%\download.windowsupdate.com" "http" "REG_DWORD" "2"
849 | call :addReg "%key%\download.windowsupdate.com" "https" "REG_DWORD" "2"
850 | call :addReg "%key%\windows.com\wustat" "http" "REG_DWORD" "2"
851 | call :addReg "%key%\wustat.windows.com" "http" "REG_DWORD" "2"
852 | call :addReg "%key%\microsoft.com\ntservicepack" "http" "REG_DWORD" "2"
853 | call :addReg "%key%\ntservicepack.microsoft.com" "http" "REG_DWORD" "2"
854 | call :addReg "%key%\microsoft.com\ws" "http" "REG_DWORD" "2"
855 | call :addReg "%key%\microsoft.com\ws" "https" "REG_DWORD" "2"
856 | call :addReg "%key%\ws.microsoft.com" "http" "REG_DWORD" "2"
857 | call :addReg "%key%\ws.microsoft.com" "https" "REG_DWORD" "2"
858 |
859 | :: ----- End process -----
860 | call :print The operation completed successfully.
861 |
862 | echo.Press any key to continue . . .
863 | pause>nul
864 | goto :eof
865 | :: /*************************************************************************************/
866 |
867 |
868 | :: Reset Winsock setting.
869 | :: void winsock();
870 | :: /*************************************************************************************/
871 | :winsock
872 | :: ----- Reset Winsock control -----
873 | call :print Reset Winsock control.
874 |
875 | call :print Restoring transaction logs.
876 | fsutil resource setautoreset true C:\
877 |
878 | call :print Restoring TPC/IP.
879 | netsh int ip reset
880 |
881 | call :print Restoring Winsock.
882 | netsh winsock reset
883 |
884 | call :print Restoring default policy settings.
885 | netsh advfirewall reset
886 |
887 | call :print Restoring the DNS cache.
888 | ipconfig /flushdns
889 |
890 | call :print Restoring the Proxy.
891 | netsh winhttp reset proxy
892 |
893 | :: ----- End process -----
894 | call :print The operation completed successfully.
895 |
896 | echo.Press any key to continue . . .
897 | pause>nul
898 | goto :eof
899 | :: /*************************************************************************************/
900 |
901 |
902 | :: Forcing group policy update.
903 | :: void gpupdate();
904 | :: /*************************************************************************************/
905 | :gpupdate
906 | call :print Forcing group policy update.
907 |
908 | if %family% NEQ 5 (
909 | gpupdate /force
910 | ) else (
911 | echo.Sorry, this option is not available on this Operative System.
912 | )
913 |
914 | if %errorlevel% EQU 0 (
915 | echo.
916 | echo.The operation completed successfully.
917 | ) else (
918 | echo.
919 | echo.An error occurred during operation.
920 | )
921 |
922 | echo.
923 | echo.Press any key to continue . . .
924 | pause>nul
925 | goto :eof
926 | :: /*************************************************************************************/
927 |
928 |
929 | :: Search Updates.
930 | :: void updates();
931 | :: /*************************************************************************************/
932 | :updates
933 | call :print Looking for updates.
934 |
935 | echo.Wait . . .
936 | echo.
937 |
938 | wuauclt /resetauthorization /detectnow
939 |
940 | if %family% EQU 10 (
941 | start ms-settings:windowsupdate-action
942 | ) else (
943 | if %family% NEQ 5 (
944 | start wuapp.exe
945 | ) else (
946 | echo.
947 | echo.An unexpected error has occurred.
948 | echo.
949 | echo.Press any key to continue . . .
950 | pause>nul
951 | )
952 | )
953 | goto :eof
954 | :: /*************************************************************************************/
955 |
956 |
957 | :: Reset the Windows Store.
958 | :: void wsreset();
959 | :: /*************************************************************************************/
960 | :wsreset
961 | call :print Resetting the Windows Store.
962 |
963 | wsreset
964 | goto :eof
965 | :: /*************************************************************************************/
966 |
967 |
968 | :: Get the Windows Product Key.
969 | :: void productKey();
970 | :: /*************************************************************************************/
971 | :productKey
972 | call :print Getting the Windows Product Key.
973 |
974 | wmic path SoftwareLicensingService get OA3xOriginalProductKey
975 |
976 | echo.
977 | echo.Press any key to continue . . .
978 | pause>nul
979 | goto :eof
980 | :: /*************************************************************************************/
981 |
982 |
983 | :: Explore other local solutions.
984 | :: void local();
985 | :: /*************************************************************************************/
986 | :local
987 | call :print Looking for solutions in this PC.
988 |
989 | if %family% NEQ 5 (
990 | start control.exe /name Microsoft.Troubleshooting
991 | ) else (
992 | echo.Sorry, this option is not available on this Operative System.
993 | echo.
994 | echo.Press any key to continue . . .
995 | pause>nul
996 | )
997 | goto :eof
998 | :: /*************************************************************************************/
999 |
1000 |
1001 | :: Explore other online solutions.
1002 | :: void online();
1003 | :: /*************************************************************************************/
1004 | :online
1005 | call :print Looking for solutions Online.
1006 |
1007 | start https://support.microsoft.com/en-us/gp/windows-update-issues/
1008 | goto :eof
1009 | :: /*************************************************************************************/
1010 |
1011 |
1012 | :: Reboot the system.
1013 | :: void restart();
1014 | :: /*************************************************************************************/
1015 | :restart
1016 | call :print Restart your PC.
1017 |
1018 | if %family% NEQ 5 (
1019 | echo. The system reboot in 60 seconds.
1020 | echo. Please save all open documents.
1021 |
1022 | start shutdown.exe /r /t 60 /c "The system reboot in 60 seconds. Please save all open documents."
1023 | ) else (
1024 | echo.Sorry, this option is not available on this Operative System.
1025 | )
1026 |
1027 | echo.
1028 | echo.Press any key to continue . . .
1029 | pause>nul
1030 | goto :eof
1031 | :: /*************************************************************************************/
1032 |
1033 |
1034 | :: Open help file.
1035 | :: void help();
1036 | :: /*************************************************************************************/
1037 | :help
1038 | start https://github.com/ManuelGil/Reset-Windows-Update-Tool/wiki
1039 | goto :eof
1040 | :: /*************************************************************************************/
1041 |
1042 |
1043 | :: diagnostic tools menu.
1044 | :: void diagnostic();
1045 | :: /*************************************************************************************/
1046 | :diagnostic
1047 | call :print Download and run diagnostics for your system.
1048 |
1049 | echo. 1. Windows Update on Windows 8 and Windows 8.1.
1050 | echo. 2. Windows Update on Windows 10.
1051 | echo. 3. Apps on Windows 8.1.
1052 | echo. 4. Apps on Windows 10.
1053 | echo.
1054 | echo. 0. Back.
1055 | echo.
1056 |
1057 | set /p option=Select an option:
1058 |
1059 | if %option% EQU 0 (
1060 | goto menu
1061 | ) else if %option% EQU 1 (
1062 | start http://go.microsoft.com/?linkid=9830262
1063 | ) else if %option% EQU 2 (
1064 | start http://aka.ms/diag_wu
1065 | ) else if %option% EQU 3 (
1066 | start http://go.microsoft.com/fwlink/p/?LinkId=268423
1067 | ) else if %option% EQU 4 (
1068 | start http://aka.ms/diag_apps10
1069 | ) else (
1070 | echo.
1071 | echo.Invalid option.
1072 | echo.
1073 | echo.Press any key to continue . . .
1074 | pause>nul
1075 | )
1076 |
1077 | goto diagnostic
1078 | goto :eof
1079 | :: /*************************************************************************************/
1080 |
1081 |
1082 | :: End tool.
1083 | :: void close();
1084 | :: /*************************************************************************************/
1085 | :close
1086 | exit
1087 | goto :eof
1088 | :: /*************************************************************************************/
1089 |
1090 |
--------------------------------------------------------------------------------