@echo off :: Imposta colori sfondo e carattere color 1F cls :: Verifica se lo script e' eseguito come amministratore >nul 2>&1 "%SYSTEMROOT%\System32\cacls.exe" "%SYSTEMROOT%\System32\Config\System" if %errorlevel% NEQ 0 ( echo Devi eseguire questo script con diritti di amministratore. echo Chiudi questo prompt e riavvia il batch selezionando "Esegui come amministratore". pause exit ) :: Messaggio iniziale per confermare l'esecuzione echo Vuoi eseguire questo script per il reset di Windows Update? [S/N] choice /c SN /n /m "Premere S per continuare o N per uscire." if errorlevel 2 exit :: Arresto dei servizi di Windows Update echo Arresto dei servizi di Windows Update net stop bits net stop wuauserv net stop appidsvc net stop cryptsvc :: Annullamento del processo di aggiornamento Windows echo Annullamento del processo di aggiornamento Windows taskkill /im wuauclt.exe /f :: Eliminazione dei file temporanei echo Eliminazione dei file qmgr*.dat del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat" del /s /q /f "%SYSTEMROOT%\Logs\WindowsUpdate\*" if exist "C:\$WinREAgent" rmdir /s /q "C:\$WinREAgent" :: Rimozione delle copie di backup echo Rimozione delle copie di backup delle cartelle di distribuzione software cd /d %SYSTEMROOT% if exist "%SYSTEMROOT%\winsxs\pending.xml.bak" ( del /s /q /f "%SYSTEMROOT%\winsxs\pending.xml.bak" ) if exist "%SYSTEMROOT%\SoftwareDistribution.bak" ( rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution.bak" ) if exist "%SYSTEMROOT%\system32\Catroot2.bak" ( rmdir /s /q "%SYSTEMROOT%\system32\Catroot2.bak" ) if exist "%SYSTEMROOT%\WindowsUpdate.log.bak" ( del /s /q /f "%SYSTEMROOT%\WindowsUpdate.log.bak" ) :: Rinomina delle cartelle echo Rinomina delle cartelle distribuzione software if exist "%SYSTEMROOT%\winsxs\pending.xml" ( takeown /f "%SYSTEMROOT%\winsxs\pending.xml" attrib -r -s -h /s /d "%SYSTEMROOT%\winsxs\pending.xml" ren "%SYSTEMROOT%\winsxs\pending.xml" pending.xml.bak ) if exist "%SYSTEMROOT%\SoftwareDistribution" ( attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution" ren "%SYSTEMROOT%\SoftwareDistribution" SoftwareDistribution.bak ) if exist "%SYSTEMROOT%\system32\Catroot2" ( attrib -r -s -h /s /d "%SYSTEMROOT%\system32\Catroot2" ren "%SYSTEMROOT%\system32\Catroot2" Catroot2.bak ) if exist "%SYSTEMROOT%\WindowsUpdate.log" ( attrib -r -s -h /s /d "%SYSTEMROOT%\WindowsUpdate.log" ren "%SYSTEMROOT%\WindowsUpdate.log" WindowsUpdate.log.bak ) :: Richiesta per eseguire il reset dei servizi BITS e Windows Update echo Vuoi eseguire anche il reset dei servizi BITS e Windows Update e una loro nuova registrazione in Windows? [S/N] choice /c SN /n /m "Premere S per eseguire o N per saltare." if errorlevel 2 goto SkipBITS :: Reset dei servizi BITS e Windows Update echo Reset dei servizi BITS e Windows Update ai descrittori di sicurezza predefiniti sc.exe sdset wuauserv D:(A;CI;CCLCSWRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOSDRCWDWO;;;WD) sc.exe sdset bits D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;SAFA;WDWO;;;BA) 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) sc.exe sdset trustedinstaller D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRRC;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;SAFA;WDWO;;;BA) :: Nuova registrazione dei file BITS e Windows Update echo Nuova registrazione dei file BITS e Windows Update cd /d %SYSTEMROOT%\system32 for %%i in (atl.dll urlmon.dll mshtml.dll shdocvw.dll browseui.dll jscript.dll vbscript.dll scrrun.dll msxml.dll msxml3.dll msxml6.dll actxprxy.dll softpub.dll wintrust.dll dssenh.dll rsaenh.dll gpkcsp.dll sccbase.dll slbcsp.dll cryptdlg.dll oleaut32.dll ole32.dll shell32.dll initpki.dll wuapi.dll wuaueng.dll wuaueng1.dll wucltui.dll wups.dll wups2.dll wuweb.dll qmgr.dll qmgrprxy.dll wucltux.dll muweb.dll wuwebv.dll) do regsvr32.exe /s %%i :SkipBITS :: Impostazione dei servizi su avvio automatico echo Impostazione dei servizi su avvio automatico sc.exe config wuauserv start= auto sc.exe config bits start= delayed-auto sc.exe config cryptsvc start= auto sc.exe config TrustedInstaller start= demand sc.exe config DcomLaunch start= auto :: Avvio dei servizi di Windows Update echo Avvio dei servizi di Windows Update net start bits net start wuauserv net start appidsvc net start cryptsvc net start DcomLaunch :: Messaggio finale echo Operazione completata con successo. echo Il sistema verra' riavviato automaticamente tra 10 secondi... shutdown /r /t 10 echo.Premere un tasto per continuare . . . pause>nul