Skip to content

Commit 90c4bd5

Browse files
authored
Refactor UltimateWindowsOptimizer.bat for clarity
1 parent ac7e4ec commit 90c4bd5

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

UltimateWindowsOptimizer.bat

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,25 @@ timeout /t 2 >nul
3434
echo ==============================================================
3535
echo 03. DEFENDER
3636
echo ==============================================================
37-
:: 2. Desactivación de Servicios y Drivers
3837
echo [+] Deshabilitando servicios y drivers de Kernel...
3938
set "list=WinDefend WdFilters WdBoot WdNisDrv WdNisSvc Sense SecurityHealthService wscsvc"
40-
for %%s in (%list%) do (
41-
reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%s" /v "Start" /t REG_DWORD /d 4 /f >nul 2>&1
42-
)
39+
for %%s in (%list%) do ( reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%s" /v "Start" /t REG_DWORD /d 4 /f >nul 2>&1 )
4340

44-
:: 3. Eliminación de la Interfaz (Versión Blindada para CMD)
4541
echo [+] Eliminando App de Seguridad (SecHealthUI)...
46-
powershell -NoProfile -ExecutionPolicy Bypass -Command "$appxpackage = Get-AppxPackage -AllUsers; $store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore'; $users = @('S-1-5-18'); if (Test-Path $store) {$users += $((Get-ChildItem $store -ErrorAction SilentlyContinue | Where-Object {$_.Name -like '*S-1-5-21*'}).PSChildName)}; foreach ($appx in $($appxpackage | Where-Object {$_.Name -like '*SecHealthUI*'})) { $PackageFullName = $appx.PackageFullName; $PackageFamilyName = $appx.PackageFamilyName; dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0; Remove-AppxPackage -Package $PackageFullName -AllUsers; Write-Host ('Eliminado: ' + $PackageFullName) -ForegroundColor Cyan }"
42+
:: TODO EL COMANDO EN UNA SOLA LÍNEA PARA EVITAR QUE CMD SE ROMPA:
43+
powershell -NoProfile -ExecutionPolicy Bypass -Command "$appx = Get-AppxPackage -AllUsers *SecHealthUI*; if ($appx) { $PackageFamilyName = $appx.PackageFamilyName; dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0; Remove-AppxPackage -Package $appx.PackageFullName -AllUsers; Write-Host 'Eliminado: SecHealthUI' -ForegroundColor Green } else { Write-Host 'SecHealthUI no encontrada.' -ForegroundColor Yellow }"
4744

48-
:: 4. Borrado Físico de Carpetas
4945
echo [+] Forzando eliminacion de carpetas de programa...
50-
:: (Sigue el resto del script...)
51-
52-
:: 5. Políticas de Grupo y Tareas Programadas
53-
echo [+] Aplicando bloqueos finales y limpiando tareas...
54-
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d 1 /f >nul 2>&1
55-
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d 1 /f >nul 2>&1
46+
for %%d in ("C:\ProgramData\Microsoft\Windows Defender" "C:\Program Files\Windows Defender" "C:\Program Files (x86)\Windows Defender" "C:\Program Files\Windows Defender Advanced Threat Protection") do (
47+
if exist "%%~d" (
48+
echo Borrando %%~d...
49+
takeown /f "%%~d" /r /d y >nul 2>&1
50+
icacls "%%~d" /grant administrators:F /t >nul 2>&1
51+
rd /s /q "%%~d" >nul 2>&1
52+
)
53+
)
5654

55+
echo [+] Limpiando tareas programadas...
5756
schtasks /delete /tn "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /f >nul 2>&1
5857
schtasks /delete /tn "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /f >nul 2>&1
5958
schtasks /delete /tn "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /f >nul 2>&1

0 commit comments

Comments
 (0)