@echo off
title iNerd Repair & IT Services - Complete Clean Uninstaller
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo Requesting Windows Administrator permission to completely remove remote support software...
    powershell.exe -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
    exit /b
)
color 0B
echo ======================================================================
echo   iNerd Repair & IT Services - Zero-Trace Clean Uninstaller
echo ======================================================================
echo Removing Windows Service, MSI registration, Scheduled Tasks and folders...
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "foreach($r in @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')){ foreach($i in @(Get-ItemProperty -Path $r -EA 0)){ if($i.DisplayName -like '*Remote Support & RMM Service*' -or $i.DisplayName -like '*iNerd*RMM*' -or $i.InstallLocation -like '*\iNerdRMM*'){ if($i.PSChildName -match '^\{[0-9A-Fa-f\-]+\}$'){ Start-Process msiexec.exe -ArgumentList ('/x "'+$i.PSChildName+'" /qn /norestart') -Wait -WindowStyle Hidden } } } }; $c=Join-Path $env:ProgramData 'iNerdRMM\config.json'; if(Test-Path $c){ try{ $t=(Get-Content -Raw $c|ConvertFrom-Json).agent_token; if($t){ [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Invoke-RestMethod -Method Post -Uri 'https://www.inerd.co.uk/remote_api.php' -ContentType 'application/json' -Body (@{action='agent_report_uninstalled';agent_token=$t;hostname=$env:COMPUTERNAME}|ConvertTo-Json -Compress) -TimeoutSec 4 | Out-Null } }catch{} }"
sc.exe stop iNerdRMMService >nul 2>&1
sc.exe delete iNerdRMMService >nul 2>&1
taskkill /F /IM iNerdRMMService.exe >nul 2>&1
schtasks.exe /Delete /TN "iNerdManagedRMM_Watchdog" /F >nul 2>&1
schtasks.exe /Delete /TN "iNerdManagedRMM_Interactive" /F >nul 2>&1
schtasks.exe /Delete /TN "iNerdManagedRMM_Tray" /F >nul 2>&1
schtasks.exe /Delete /TN "iNerdManagedRMM" /F >nul 2>&1
schtasks.exe /Delete /TN "iNerdRMMUpdateToast" /F >nul 2>&1
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "try{ Add-Type -TypeDefinition 'using System;using System.Runtime.InteropServices;public static class InerdTraySigC{[DllImport(\"user32.dll\",CharSet=CharSet.Unicode)]public static extern IntPtr FindWindow(string c,string w);[DllImport(\"user32.dll\")]public static extern bool PostMessage(IntPtr h,uint m,IntPtr w,IntPtr l);}' -EA 0; foreach($w in @('iNerdSessionDockWindow','iNerdTraySignalWindow')){ $h=[InerdTraySigC]::FindWindow($null,$w); if($h -ne [IntPtr]::Zero){ [InerdTraySigC]::PostMessage($h,0x802B,[IntPtr]::Zero,[IntPtr]::Zero)|Out-Null } } }catch{}" >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "iNerdManagedRMM" /f >nul 2>&1
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "iNerdManagedRMM" /f >nul 2>&1
reg delete "HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" /v "iNerdManagedRMM" /f >nul 2>&1
cd /d "%SystemRoot%\System32"
ping 127.0.0.1 -n 3 >nul 2>&1
rmdir /S /Q "%ProgramFiles%\iNerdRMM" >nul 2>&1
rmdir /S /Q "%ProgramFiles(x86)%\iNerdRMM" >nul 2>&1
rmdir /S /Q "%ProgramData%\iNerdRMM" >nul 2>&1
for /D %%U in ("C:\Users\*") do (
    rmdir /S /Q "%%~fU\AppData\Local\iNerdRMM" >nul 2>&1
    del /F /Q "%%~fU\Downloads\iNerd-QuickSupport-*.exe" "%%~fU\Downloads\*-Remote-RMM-*.msi" "%%~fU\Downloads\*-24-7-Setup.cmd" "%%~fU\Downloads\*-USB-Enroll-*.cmd" "%%~fU\Downloads\*-Remote-Connect-*.cmd" >nul 2>&1
)
del /F /Q "%TEMP%\iNerd-*" >nul 2>&1
echo.
echo COMPLETE: All iNerd Repair & IT Services remote support files, services, and tasks have been removed.
ping 127.0.0.1 -n 4 >nul 2>&1
(goto) 2>nul & del /F /Q "%~f0"
