Загрузка данных


# Запускай
$ErrorActionPreference = 'SilentlyContinue'

$needle = 'Radmin VPN'
$found = $false

function Hit {
    param([string]$Msg)
    $script:found = $true
    Write-Host $Msg
}

function Match-Text {
    param([string]$Text)
    return ($null -ne $Text -and $Text -like "*$needle*")
}

# 1) Файлы и папки по всей системе
Get-PSDrive -PSProvider FileSystem | ForEach-Object {
    $root = $_.Root
    Get-ChildItem -LiteralPath $root -Force -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
        if (Match-Text $_.Name -or Match-Text $_.FullName) {
            Hit "Найдено в файловой системе: $($_.FullName)"
        }
    }
}

# 2) Реестр
$regRoots = @(
    'HKLM:\SOFTWARE',
    'HKCU:\SOFTWARE',
    'HKCR:\',
    'HKU:\'
)

foreach ($root in $regRoots) {
    if (Test-Path $root) {
        Get-ChildItem $root -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
            if (Match-Text $_.Name) {
                Hit "Найдено в реестре (ключ): $($_.Name)"
            }

            try {
                $props = Get-ItemProperty $_.PsPath -ErrorAction SilentlyContinue
                if ($props) {
                    foreach ($p in $props.PSObject.Properties) {
                        if ($p.Name -like 'PS*') { continue }
                        $val = $p.Value
                        if ($val -is [string] -and (Match-Text $val)) {
                            Hit "Найдено в реестре (значение): $($_.Name)"
                        }
                        elseif ($val -is [string[]] -and (Match-Text ($val -join ' '))) {
                            Hit "Найдено в реестре (значение): $($_.Name)"
                        }
                    }
                }
            } catch {}
        }
    }
}

# 3) Службы
Get-CimInstance Win32_Service | ForEach-Object {
    if (Match-Text $_.Name -or Match-Text $_.DisplayName -or Match-Text $_.PathName) {
        Hit "Найдена служба: $($_.DisplayName)"
    }
}

# 4) Планировщик
try {
    Get-ScheduledTask | ForEach-Object {
        if (Match-Text $_.TaskName -or Match-Text $_.TaskPath) {
            Hit "Найдена задача планировщика: $($_.TaskPath)$($_.TaskName)"
        }
    }
} catch {}

# 5) Стандартные записи удаления программ
$uninstallRoots = @(
    'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
    'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall',
    'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
)

foreach ($root in $uninstallRoots) {
    if (Test-Path $root) {
        Get-ChildItem $root | ForEach-Object {
            try {
                $p = Get-ItemProperty $_.PsPath
                if (Match-Text $p.DisplayName -or Match-Text $p.DisplayVersion -or Match-Text $p.Publisher) {
                    Hit "Найдена запись удаления: $($p.DisplayName)"
                }
            } catch {}
        }
    }
}

if ($found) {
    Write-Host "мусора много, нужно ещё почистить"
} else {
    Write-Host "радуйся жизни он ликвидирован."
}