w10install/scripts/uninstall-pchealth.cmd
2024-07-18 14:18:49 +02:00

45 lines
1.6 KiB
Batchfile

@echo off
echo ####### %0 #######
if EXIST "%ProgramFiles%\Microsoft Update Health Tools" (
sc stop uhssvc
sc delete uhssvc
echo removing PC health update folder ...
superuser /sw cmd.exe /C rd /S /Q "%ProgramFiles%\Microsoft Update Health Tools" 2>nul
)
if NOT exist "%ProgramFiles%\PCHealthCheck\PCHealthCheck.exe" (
echo PC health check is NOT installed!
echo ####### %0 #######
exit /b
)
echo KILLING PC health check ...
taskkill /f /im PCHealthCheck.exe > NUL 2>&1
echo DELETING PC health check folder ...
rd "%ProgramFiles%\PCHealthCheck" /Q /S > NUL 2>&1
echo remove PC health check from application list ...
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7B1FCD52-8F6B-4F12-A143-361EA39F5E7C}" /f > NUL 2>&1
rem ... also the german registry entry ...
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B3956CF3-F6C5-4567-AC38-1FD4432B319C}" /f > NUL 2>&1
echo removing PC health check registry keys ...
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHealthCheck" /f > NUL 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHC" /f > NUL 2>&1
echo blocking Microsoft reinstall attempts ...
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHealthCheck" ^
/v "installed" /t REG_DWORD /d 1 /f > NUL 2>&1
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHC" ^
/v "PreviousUninstall" /t REG_DWORD /d 1 /f > NUL 2>&1
echo removing link in Start menu ...
del /F /Q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\PC Health Check.lnk" 2>nul
echo ####### %0 #######