HBB BLOG
首页
登录
🌙
IDM下载神器
📅 2026-04-17
📂 工具
📝 1883 字
⏱️ 7 分钟
👁️ 1
### 免费试用到期前使用管理员身份执行以下代码,保存ANSI格式文本,执行即可: 官网下载地址:https://www.internetdownloadmanager.com ```PowerShell @setlocal DisableDelayedExpansion @echo off title IDM 试用期一键永久冻结工具 (Win11/6.43 专用) mode con cols=80 lines=25 color 0a :: 1. 管理员权限自动提权 fltmc >nul 2>&1 || ( echo [*] 正在请求管理员权限... powershell Start-Process -FilePath "%~f0" -ArgumentList "%*" -Verb RunAs exit /b ) :: 2. 初始化环境路径 set "PATH=%SystemRoot%\System32;%SystemRoot%\System32\wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\" set "_batf=%~f0" set "_batp=%_batf:'=''%" set "nul1=1>nul" set "nul2=2>nul" set "nul6=2^>nul" set "nul=>nul 2>&1" set psc=powershell.exe :: 检测系统架构 (x64 / x86) for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE') do set arch=%%b if /i not "%arch%"=="x86" set arch=x64 :: 3. 获取当前登录用户的真实 SID set _sid= for /f "delims=" %%a in ('%psc% "([System.Security.Principal.NTAccount](Get-WmiObject -Class Win32_ComputerSystem).UserName).Translate([System.Security.Principal.SecurityIdentifier]).Value" %nul6%') do (set _sid=%%a) :: 检测用户 SID 注册表同步状态 set HKCUsync=$null reg add HKCU\IAS_TEST >nul 2>&1 reg query HKU\%_sid%\IAS_TEST >nul 2>&1 && (set HKCUsync=1) reg delete HKCU\IAS_TEST /f >nul 2>&1 reg delete HKU\%_sid%\IAS_TEST /f >nul 2>&1 :: 根据架构和同步状态定义注册表路径 if "%arch%"=="x86" ( set "CLSID=HKCU\Software\Classes\CLSID" set "CLSID2=HKU\%_sid%\Software\Classes\CLSID" set "HKLM=HKLM\Software\Internet Download Manager" ) else ( set "CLSID=HKCU\Software\Classes\Wow6432Node\CLSID" set "CLSID2=HKU\%_sid%\Software\Classes\Wow6432Node\CLSID" set "HKLM=HKLM\SOFTWARE\Wow6432Node\Internet Download Manager" ) :: 自动定位 IDMan.exe 路径 for /f "tokens=2*" %%a in ('reg query "HKU\%_sid%\Software\DownloadManager" /v ExePath %nul6%') do call set "IDMan=%%b" if not exist "%IDMan%" ( if %arch%==x64 set "IDMan=%ProgramFiles(x86)%\Internet Download Manager\IDMan.exe" if %arch%==x86 set "IDMan=%ProgramFiles%\Internet Download Manager\IDMan.exe" ) if not exist "%IDMan%" ( echo [错误] 未在默认路径检测到安装的 IDM,请安装官方原版后再运行此脚本。 pause exit /b ) :: 4. 强制结束正在运行的 IDM 进程 echo [*] 正在终止后台运行的 IDM 进程... tasklist /fi "imagename eq idman.exe" | findstr /i "idman.exe" >nul && taskkill /f /im idman.exe >nul 2>&1 tasklist /fi "imagename eq iemonitor.exe" | findstr /i "iemonitor.exe" >nul && taskkill /f /im iemonitor.exe >nul 2>&1 :: 5. 备份原始 CLSID 注册表(安全防范,若出现意外可在系统 Temp 目录找到备份) set _time= for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time=%%a echo [*] 正在备份原 CLSID 注册表至 %SystemRoot%\Temp ... reg export %CLSID% "%SystemRoot%\Temp\_Backup_HKCU_CLSID_%_time%.reg" >nul 2>&1 if not %HKCUsync%==1 reg export %CLSID2% "%SystemRoot%\Temp\_Backup_HKU-%_sid%_CLSID_%_time%.reg" >nul 2>&1 :: 6. 清理可能残留的到期标记和此前可能尝试激活过的假序列号 echo [*] 正在重置并清理残留的到期标记... call :delete_queue :: 7. 添加配置并启动第一阶段注册表锁定 echo [*] 正在优化配置项... reg add "%HKLM%" /v "AdvIntDriverEnabled2" /t REG_DWORD /d "1" /f >nul 2>&1 echo [*] 正在执行第一阶段:扫描并锁定试用注册表 (1/2)... setlocal EnableDelayedExpansion %psc% "$sid = '%_sid%'; $HKCUsync = %HKCUsync%; $lockKey = 1; $deleteKey = $null; $toggle = 1; $f=[io.file]::ReadAllText('!_batp!') -split ':regscan\:.*';iex ($f[1])" :: 8. 背景触发微型下载(唤醒 IDM 从而强制生成所有的注册表安全校验节点) echo [*] 正在安全唤醒 IDM 生成校验节点,请稍候... call :download_files :: 9. 启动第二阶段最终锁死 echo [*] 正在执行第二阶段:锁死新生成的试用注册表 (2/2)... %psc% "$sid = '%_sid%'; $HKCUsync = %HKCUsync%; $lockKey = 1; $deleteKey = $null; $f=[io.file]::ReadAllText('!_batp!') -split ':regscan\:.*';iex ($f[1])" echo. echo ============================================================ echo [成功] IDM 30天试用期已被永久冻结! echo IDM 将无法在注册表中推进时间,您可以永久免费使用。 echo ============================================================ echo. pause exit /b :: ====================== 子函数模块 ====================== :delete_queue for %%# in ( ""HKCU\Software\DownloadManager" "/v" "FName"" ""HKCU\Software\DownloadManager" "/v" "LName"" ""HKCU\Software\DownloadManager" "/v" "Email"" ""HKCU\Software\DownloadManager" "/v" "Serial"" ""HKCU\Software\DownloadManager" "/v" "scansk"" ""HKCU\Software\DownloadManager" "/v" "tvfrdt"" ""HKCU\Software\DownloadManager" "/v" "radxcnt"" ""HKCU\Software\DownloadManager" "/v" "LstCheck"" ""HKCU\Software\DownloadManager" "/v" "ptrk_scdt"" ""HKCU\Software\DownloadManager" "/v" "LastCheckQU"" "%HKLM%" ) do for /f "tokens=* delims=" %%A in ("%%~#") do ( reg delete %%~A /f >nul 2>&1 ) if not %HKCUsync%==1 for %%# in ( ""HKU\%_sid%\Software\DownloadManager" "/v" "FName"" ""HKU\%_sid%\Software\DownloadManager" "/v" "LName"" ""HKU\%_sid%\Software\DownloadManager" "/v" "Email"" ""HKU\%_sid%\Software\DownloadManager" "/v" "Serial"" ""HKU\%_sid%\Software\DownloadManager" "/v" "scansk"" ""HKU\%_sid%\Software\DownloadManager" "/v" "tvfrdt"" ""HKU\%_sid%\Software\DownloadManager" "/v" "radxcnt"" ""HKU\%_sid%\Software\DownloadManager" "/v" "LstCheck"" ""HKU\%_sid%\Software\DownloadManager" "/v" "ptrk_scdt"" ""HKU\%_sid%\Software\DownloadManager" "/v" "LastCheckQU"" ) do for /f "tokens=* delims=" %%A in ("%%~#") do ( reg delete %%~A /f >nul 2>&1 ) exit /b :download_files set "file=%SystemRoot%\Temp\temp.png" set link=https://www.internetdownloadmanager.com/images/idm_box_min.png call :download set link=https://www.internetdownloadmanager.com/register/IDMlib/images/idman_logos.png call :download set link=https://www.internetdownloadmanager.com/pictures/idm_about.png call :download timeout /t 3 >nul tasklist /fi "imagename eq idman.exe" | findstr /i "idman.exe" >nul && taskkill /f /im idman.exe >nul 2>&1 if exist "%file%" del /f /q "%file%" exit /b :download set /a attempt=0 if exist "%file%" del /f /q "%file%" start "" /B "%IDMan%" /n /d "%link%" /p "%SystemRoot%\Temp" /f temp.png :check_file timeout /t 1 >nul set /a attempt+=1 if exist "%file%" exit /b if %attempt% GEQ 20 exit /b goto :check_file :: ====================== PowerShell 核心扫描锁定函数 ====================== :regscan: $finalValues = @() $arch = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment').PROCESSOR_ARCHITECTURE if ($arch -eq "x86") { $regPaths = @("HKCU:\Software\Classes\CLSID", "Registry::HKEY_USERS\$sid\Software\Classes\CLSID") } else { $regPaths = @("HKCU:\Software\Classes\WOW6432Node\CLSID", "Registry::HKEY_USERS\$sid\Software\Classes\Wow6432Node\CLSID") } foreach ($regPath in $regPaths) { if (($regPath -match "HKEY_USERS") -and ($HKCUsync -ne $null)) { continue } $subKeys = Get-ChildItem -Path $regPath -ErrorAction SilentlyContinue -ErrorVariable lockedKeys | Where-Object { $_.PSChildName -match '^\{[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}\}$' } foreach ($lockedKey in $lockedKeys) { $leafValue = Split-Path -Path $lockedKey.TargetObject -Leaf $finalValues += $leafValue } if ($subKeys -eq $null) { continue } $subKeysToExclude = "LocalServer32", "InProcServer32", "InProcHandler32" $filteredKeys = $subKeys | Where-Object { !($_.GetSubKeyNames() | Where-Object { $subKeysToExclude -contains $_ }) } foreach ($key in $filteredKeys) { $fullPath = $key.PSPath $keyValues = Get-ItemProperty -Path $fullPath -ErrorAction SilentlyContinue $defaultValue = $keyValues.PSObject.Properties | Where-Object { $_.Name -eq '(default)' } | Select-Object -ExpandProperty Value if (($defaultValue -match "^\d+$") -and ($key.SubKeyCount -eq 0)) { $finalValues += $($key.PSChildName) continue } if (($defaultValue -match "\+|=") -and ($key.SubKeyCount -eq 0)) { $finalValues += $($key.PSChildName) continue } $versionValue = Get-ItemProperty -Path "$fullPath\Version" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty '(default)' -ErrorAction SilentlyContinue if (($versionValue -match "^\d+$") -and ($key.SubKeyCount -eq 1)) { $finalValues += $($key.PSChildName) continue } $keyValues.PSObject.Properties | ForEach-Object { if ($_.Name -match "MData|Model|scansk|Therad") { $finalValues += $($key.PSChildName) continue } } if (($key.ValueCount -eq 0) -and ($key.SubKeyCount -eq 0)) { $finalValues += $($key.PSChildName) continue } } } $finalValues = @($finalValues | Select-Object -Unique) if ($finalValues -eq $null) { Exit } if (($finalValues.Count -gt 20) -and ($toggle -ne $null)) { $lockKey = $null $deleteKey = 1 } function Take-Permissions { param($rootKey, $regKey) $AssemblyBuilder = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1) $ModuleBuilder = $AssemblyBuilder.DefineDynamicModule(2, $False) $TypeBuilder = $ModuleBuilder.DefineType(0) $TypeBuilder.DefinePInvokeMethod('RtlAdjustPrivilege', 'ntdll.dll', 'Public, Static', 1, [int], @([int], [bool], [bool], [bool].MakeByRefType()), 1, 3) | Out-Null 9,17,18 | ForEach-Object { $TypeBuilder.CreateType()::RtlAdjustPrivilege($_, $true, $false, [ref]$false) | Out-Null } $SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544') $IDN = ($SID.Translate([System.Security.Principal.NTAccount])).Value $Admin = New-Object System.Security.Principal.NTAccount($IDN) $everyone = New-Object System.Security.Principal.SecurityIdentifier('S-1-1-0') $none = New-Object System.Security.Principal.SecurityIdentifier('S-1-0-0') $key = [Microsoft.Win32.Registry]::$rootKey.OpenSubKey($regkey, 'ReadWriteSubTree', 'TakeOwnership') $acl = New-Object System.Security.AccessControl.RegistrySecurity $acl.SetOwner($Admin) $key.SetAccessControl($acl) $key = $key.OpenSubKey('', 'ReadWriteSubTree', 'ChangePermissions') $rule = New-Object System.Security.AccessControl.RegistryAccessRule($everyone, 'FullControl', 'ContainerInherit', 'None', 'Allow') $acl.ResetAccessRule($rule) $key.SetAccessControl($acl) if ($lockKey -ne $null) { $acl = New-Object System.Security.AccessControl.RegistrySecurity $acl.SetOwner($none) $key.SetAccessControl($acl) $key = $key.OpenSubKey('', 'ReadWriteSubTree', 'ChangePermissions') $rule = New-Object System.Security.AccessControl.RegistryAccessRule($everyone, 'FullControl', 'Deny') $acl.ResetAccessRule($rule) $key.SetAccessControl($acl) } } foreach ($regPath in $regPaths) { if (($regPath -match "HKEY_USERS") -and ($HKCUsync -ne $null)) { continue } foreach ($finalValue in $finalValues) { $fullPath = Join-Path -Path $regPath -ChildPath $finalValue if ($fullPath -match 'HKCU:') { $rootKey = 'CurrentUser' } else { $rootKey = 'Users' } $position = $fullPath.IndexOf("\") $regKey = $fullPath.Substring($position + 1) if ($lockKey -ne $null) { if (-not (Test-Path -Path $fullPath -ErrorAction SilentlyContinue)) { New-Item -Path $fullPath -Force -ErrorAction SilentlyContinue | Out-Null } Take-Permissions $rootKey $regKey try { Remove-Item -Path $fullPath -Force -Recurse -ErrorAction Stop } catch { # Locked successfully } } if ($deleteKey -ne $null) { if (Test-Path -Path $fullPath) { Remove-Item -Path $fullPath -Force -Recurse -ErrorAction SilentlyContinue if (Test-Path -Path $fullPath) { Take-Permissions $rootKey $regKey try { Remove-Item -Path $fullPath -Force -Recurse -ErrorAction Stop } catch { # Failed to delete } } } } } } :regscan: ``` --- ## 卸载重装安全可删除的 IDM 残留项 * idmwfp.inf_amd64_1245af3f626dcbc0(位置C:\Windows\System32\DriverStore\FileRepository\...)—— IDM 网络过滤驱动备份 ### 以下项均在 C:\Windows\System32\DriverStore\FileRepository\idmwfp_inf_... 目录下,**均可删除**: * idmwfp.inf_amd64_1245af3f626dcbc0.ini * idmwfp64.sys(IDM 网络驱动) * idmwfp.cat * idmwfp.inf * idmwfp.PNF * idman.exe(位置...Windows Script\Settings\Telemetry) * idman.chm(位置...Start\TileProperties\...) * IDMan.exe(位置...Start\TileProperties\...) * IDMan_RASAPI32(位置...WOW6432Node\Microsoft\Tracing) * IDMan_RASMANCS(位置...WOW6432Node\Microsoft\Tracing) ### 以下为 IDM 注册的 COM 组件接口和配置项,**可以删除**: * IIDMEFSAgent5(位置HKEY_CLASSES_ROOT\WOW6432Node\Interface\...) * IIDMAIILinksProcessor * IIDMEFSAgent8 * ICDMLinkTransmitter * IIDMEFSAgent2 * IIDMEFSAgent * ICDMLinkTransmitter2 * IIDMIEHlprObj * IIDMEFSAgent3 * IIDMHelperLinksStorage * IIDMEFSAgent7 * IDMan(位置HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\...)
# 脚本
← 上一篇
Windows免工具纯命令行激活全指南
下一篇 →
激活码
💬 评论
0
/1000
发表评论
加载中...
### 免费试用到期前使用管理员身份执行以下代码,保存ANSI格式文本,执行即可: 官网下载地址:https://www.internetdownloadmanager.com ```PowerShell @setlocal DisableDelayedExpansion @echo off title IDM 试用期一键永久冻结工具 (Win11/6.43 专用) mode con cols=80 lines=25 color 0a :: 1. 管理员权限自动提权 fltmc >nul 2>&1 || ( echo [*] 正在请求管理员权限... powershell Start-Process -FilePath "%~f0" -ArgumentList "%*" -Verb RunAs exit /b ) :: 2. 初始化环境路径 set "PATH=%SystemRoot%\System32;%SystemRoot%\System32\wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\" set "_batf=%~f0" set "_batp=%_batf:'=''%" set "nul1=1>nul" set "nul2=2>nul" set "nul6=2^>nul" set "nul=>nul 2>&1" set psc=powershell.exe :: 检测系统架构 (x64 / x86) for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE') do set arch=%%b if /i not "%arch%"=="x86" set arch=x64 :: 3. 获取当前登录用户的真实 SID set _sid= for /f "delims=" %%a in ('%psc% "([System.Security.Principal.NTAccount](Get-WmiObject -Class Win32_ComputerSystem).UserName).Translate([System.Security.Principal.SecurityIdentifier]).Value" %nul6%') do (set _sid=%%a) :: 检测用户 SID 注册表同步状态 set HKCUsync=$null reg add HKCU\IAS_TEST >nul 2>&1 reg query HKU\%_sid%\IAS_TEST >nul 2>&1 && (set HKCUsync=1) reg delete HKCU\IAS_TEST /f >nul 2>&1 reg delete HKU\%_sid%\IAS_TEST /f >nul 2>&1 :: 根据架构和同步状态定义注册表路径 if "%arch%"=="x86" ( set "CLSID=HKCU\Software\Classes\CLSID" set "CLSID2=HKU\%_sid%\Software\Classes\CLSID" set "HKLM=HKLM\Software\Internet Download Manager" ) else ( set "CLSID=HKCU\Software\Classes\Wow6432Node\CLSID" set "CLSID2=HKU\%_sid%\Software\Classes\Wow6432Node\CLSID" set "HKLM=HKLM\SOFTWARE\Wow6432Node\Internet Download Manager" ) :: 自动定位 IDMan.exe 路径 for /f "tokens=2*" %%a in ('reg query "HKU\%_sid%\Software\DownloadManager" /v ExePath %nul6%') do call set "IDMan=%%b" if not exist "%IDMan%" ( if %arch%==x64 set "IDMan=%ProgramFiles(x86)%\Internet Download Manager\IDMan.exe" if %arch%==x86 set "IDMan=%ProgramFiles%\Internet Download Manager\IDMan.exe" ) if not exist "%IDMan%" ( echo [错误] 未在默认路径检测到安装的 IDM,请安装官方原版后再运行此脚本。 pause exit /b ) :: 4. 强制结束正在运行的 IDM 进程 echo [*] 正在终止后台运行的 IDM 进程... tasklist /fi "imagename eq idman.exe" | findstr /i "idman.exe" >nul && taskkill /f /im idman.exe >nul 2>&1 tasklist /fi "imagename eq iemonitor.exe" | findstr /i "iemonitor.exe" >nul && taskkill /f /im iemonitor.exe >nul 2>&1 :: 5. 备份原始 CLSID 注册表(安全防范,若出现意外可在系统 Temp 目录找到备份) set _time= for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time=%%a echo [*] 正在备份原 CLSID 注册表至 %SystemRoot%\Temp ... reg export %CLSID% "%SystemRoot%\Temp\_Backup_HKCU_CLSID_%_time%.reg" >nul 2>&1 if not %HKCUsync%==1 reg export %CLSID2% "%SystemRoot%\Temp\_Backup_HKU-%_sid%_CLSID_%_time%.reg" >nul 2>&1 :: 6. 清理可能残留的到期标记和此前可能尝试激活过的假序列号 echo [*] 正在重置并清理残留的到期标记... call :delete_queue :: 7. 添加配置并启动第一阶段注册表锁定 echo [*] 正在优化配置项... reg add "%HKLM%" /v "AdvIntDriverEnabled2" /t REG_DWORD /d "1" /f >nul 2>&1 echo [*] 正在执行第一阶段:扫描并锁定试用注册表 (1/2)... setlocal EnableDelayedExpansion %psc% "$sid = '%_sid%'; $HKCUsync = %HKCUsync%; $lockKey = 1; $deleteKey = $null; $toggle = 1; $f=[io.file]::ReadAllText('!_batp!') -split ':regscan\:.*';iex ($f[1])" :: 8. 背景触发微型下载(唤醒 IDM 从而强制生成所有的注册表安全校验节点) echo [*] 正在安全唤醒 IDM 生成校验节点,请稍候... call :download_files :: 9. 启动第二阶段最终锁死 echo [*] 正在执行第二阶段:锁死新生成的试用注册表 (2/2)... %psc% "$sid = '%_sid%'; $HKCUsync = %HKCUsync%; $lockKey = 1; $deleteKey = $null; $f=[io.file]::ReadAllText('!_batp!') -split ':regscan\:.*';iex ($f[1])" echo. echo ============================================================ echo [成功] IDM 30天试用期已被永久冻结! echo IDM 将无法在注册表中推进时间,您可以永久免费使用。 echo ============================================================ echo. pause exit /b :: ====================== 子函数模块 ====================== :delete_queue for %%# in ( ""HKCU\Software\DownloadManager" "/v" "FName"" ""HKCU\Software\DownloadManager" "/v" "LName"" ""HKCU\Software\DownloadManager" "/v" "Email"" ""HKCU\Software\DownloadManager" "/v" "Serial"" ""HKCU\Software\DownloadManager" "/v" "scansk"" ""HKCU\Software\DownloadManager" "/v" "tvfrdt"" ""HKCU\Software\DownloadManager" "/v" "radxcnt"" ""HKCU\Software\DownloadManager" "/v" "LstCheck"" ""HKCU\Software\DownloadManager" "/v" "ptrk_scdt"" ""HKCU\Software\DownloadManager" "/v" "LastCheckQU"" "%HKLM%" ) do for /f "tokens=* delims=" %%A in ("%%~#") do ( reg delete %%~A /f >nul 2>&1 ) if not %HKCUsync%==1 for %%# in ( ""HKU\%_sid%\Software\DownloadManager" "/v" "FName"" ""HKU\%_sid%\Software\DownloadManager" "/v" "LName"" ""HKU\%_sid%\Software\DownloadManager" "/v" "Email"" ""HKU\%_sid%\Software\DownloadManager" "/v" "Serial"" ""HKU\%_sid%\Software\DownloadManager" "/v" "scansk"" ""HKU\%_sid%\Software\DownloadManager" "/v" "tvfrdt"" ""HKU\%_sid%\Software\DownloadManager" "/v" "radxcnt"" ""HKU\%_sid%\Software\DownloadManager" "/v" "LstCheck"" ""HKU\%_sid%\Software\DownloadManager" "/v" "ptrk_scdt"" ""HKU\%_sid%\Software\DownloadManager" "/v" "LastCheckQU"" ) do for /f "tokens=* delims=" %%A in ("%%~#") do ( reg delete %%~A /f >nul 2>&1 ) exit /b :download_files set "file=%SystemRoot%\Temp\temp.png" set link=https://www.internetdownloadmanager.com/images/idm_box_min.png call :download set link=https://www.internetdownloadmanager.com/register/IDMlib/images/idman_logos.png call :download set link=https://www.internetdownloadmanager.com/pictures/idm_about.png call :download timeout /t 3 >nul tasklist /fi "imagename eq idman.exe" | findstr /i "idman.exe" >nul && taskkill /f /im idman.exe >nul 2>&1 if exist "%file%" del /f /q "%file%" exit /b :download set /a attempt=0 if exist "%file%" del /f /q "%file%" start "" /B "%IDMan%" /n /d "%link%" /p "%SystemRoot%\Temp" /f temp.png :check_file timeout /t 1 >nul set /a attempt+=1 if exist "%file%" exit /b if %attempt% GEQ 20 exit /b goto :check_file :: ====================== PowerShell 核心扫描锁定函数 ====================== :regscan: $finalValues = @() $arch = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment').PROCESSOR_ARCHITECTURE if ($arch -eq "x86") { $regPaths = @("HKCU:\Software\Classes\CLSID", "Registry::HKEY_USERS\$sid\Software\Classes\CLSID") } else { $regPaths = @("HKCU:\Software\Classes\WOW6432Node\CLSID", "Registry::HKEY_USERS\$sid\Software\Classes\Wow6432Node\CLSID") } foreach ($regPath in $regPaths) { if (($regPath -match "HKEY_USERS") -and ($HKCUsync -ne $null)) { continue } $subKeys = Get-ChildItem -Path $regPath -ErrorAction SilentlyContinue -ErrorVariable lockedKeys | Where-Object { $_.PSChildName -match '^\{[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}\}$' } foreach ($lockedKey in $lockedKeys) { $leafValue = Split-Path -Path $lockedKey.TargetObject -Leaf $finalValues += $leafValue } if ($subKeys -eq $null) { continue } $subKeysToExclude = "LocalServer32", "InProcServer32", "InProcHandler32" $filteredKeys = $subKeys | Where-Object { !($_.GetSubKeyNames() | Where-Object { $subKeysToExclude -contains $_ }) } foreach ($key in $filteredKeys) { $fullPath = $key.PSPath $keyValues = Get-ItemProperty -Path $fullPath -ErrorAction SilentlyContinue $defaultValue = $keyValues.PSObject.Properties | Where-Object { $_.Name -eq '(default)' } | Select-Object -ExpandProperty Value if (($defaultValue -match "^\d+$") -and ($key.SubKeyCount -eq 0)) { $finalValues += $($key.PSChildName) continue } if (($defaultValue -match "\+|=") -and ($key.SubKeyCount -eq 0)) { $finalValues += $($key.PSChildName) continue } $versionValue = Get-ItemProperty -Path "$fullPath\Version" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty '(default)' -ErrorAction SilentlyContinue if (($versionValue -match "^\d+$") -and ($key.SubKeyCount -eq 1)) { $finalValues += $($key.PSChildName) continue } $keyValues.PSObject.Properties | ForEach-Object { if ($_.Name -match "MData|Model|scansk|Therad") { $finalValues += $($key.PSChildName) continue } } if (($key.ValueCount -eq 0) -and ($key.SubKeyCount -eq 0)) { $finalValues += $($key.PSChildName) continue } } } $finalValues = @($finalValues | Select-Object -Unique) if ($finalValues -eq $null) { Exit } if (($finalValues.Count -gt 20) -and ($toggle -ne $null)) { $lockKey = $null $deleteKey = 1 } function Take-Permissions { param($rootKey, $regKey) $AssemblyBuilder = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1) $ModuleBuilder = $AssemblyBuilder.DefineDynamicModule(2, $False) $TypeBuilder = $ModuleBuilder.DefineType(0) $TypeBuilder.DefinePInvokeMethod('RtlAdjustPrivilege', 'ntdll.dll', 'Public, Static', 1, [int], @([int], [bool], [bool], [bool].MakeByRefType()), 1, 3) | Out-Null 9,17,18 | ForEach-Object { $TypeBuilder.CreateType()::RtlAdjustPrivilege($_, $true, $false, [ref]$false) | Out-Null } $SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544') $IDN = ($SID.Translate([System.Security.Principal.NTAccount])).Value $Admin = New-Object System.Security.Principal.NTAccount($IDN) $everyone = New-Object System.Security.Principal.SecurityIdentifier('S-1-1-0') $none = New-Object System.Security.Principal.SecurityIdentifier('S-1-0-0') $key = [Microsoft.Win32.Registry]::$rootKey.OpenSubKey($regkey, 'ReadWriteSubTree', 'TakeOwnership') $acl = New-Object System.Security.AccessControl.RegistrySecurity $acl.SetOwner($Admin) $key.SetAccessControl($acl) $key = $key.OpenSubKey('', 'ReadWriteSubTree', 'ChangePermissions') $rule = New-Object System.Security.AccessControl.RegistryAccessRule($everyone, 'FullControl', 'ContainerInherit', 'None', 'Allow') $acl.ResetAccessRule($rule) $key.SetAccessControl($acl) if ($lockKey -ne $null) { $acl = New-Object System.Security.AccessControl.RegistrySecurity $acl.SetOwner($none) $key.SetAccessControl($acl) $key = $key.OpenSubKey('', 'ReadWriteSubTree', 'ChangePermissions') $rule = New-Object System.Security.AccessControl.RegistryAccessRule($everyone, 'FullControl', 'Deny') $acl.ResetAccessRule($rule) $key.SetAccessControl($acl) } } foreach ($regPath in $regPaths) { if (($regPath -match "HKEY_USERS") -and ($HKCUsync -ne $null)) { continue } foreach ($finalValue in $finalValues) { $fullPath = Join-Path -Path $regPath -ChildPath $finalValue if ($fullPath -match 'HKCU:') { $rootKey = 'CurrentUser' } else { $rootKey = 'Users' } $position = $fullPath.IndexOf("\") $regKey = $fullPath.Substring($position + 1) if ($lockKey -ne $null) { if (-not (Test-Path -Path $fullPath -ErrorAction SilentlyContinue)) { New-Item -Path $fullPath -Force -ErrorAction SilentlyContinue | Out-Null } Take-Permissions $rootKey $regKey try { Remove-Item -Path $fullPath -Force -Recurse -ErrorAction Stop } catch { # Locked successfully } } if ($deleteKey -ne $null) { if (Test-Path -Path $fullPath) { Remove-Item -Path $fullPath -Force -Recurse -ErrorAction SilentlyContinue if (Test-Path -Path $fullPath) { Take-Permissions $rootKey $regKey try { Remove-Item -Path $fullPath -Force -Recurse -ErrorAction Stop } catch { # Failed to delete } } } } } } :regscan: ``` --- ## 卸载重装安全可删除的 IDM 残留项 * idmwfp.inf_amd64_1245af3f626dcbc0(位置C:\Windows\System32\DriverStore\FileRepository\...)—— IDM 网络过滤驱动备份 ### 以下项均在 C:\Windows\System32\DriverStore\FileRepository\idmwfp_inf_... 目录下,**均可删除**: * idmwfp.inf_amd64_1245af3f626dcbc0.ini * idmwfp64.sys(IDM 网络驱动) * idmwfp.cat * idmwfp.inf * idmwfp.PNF * idman.exe(位置...Windows Script\Settings\Telemetry) * idman.chm(位置...Start\TileProperties\...) * IDMan.exe(位置...Start\TileProperties\...) * IDMan_RASAPI32(位置...WOW6432Node\Microsoft\Tracing) * IDMan_RASMANCS(位置...WOW6432Node\Microsoft\Tracing) ### 以下为 IDM 注册的 COM 组件接口和配置项,**可以删除**: * IIDMEFSAgent5(位置HKEY_CLASSES_ROOT\WOW6432Node\Interface\...) * IIDMAIILinksProcessor * IIDMEFSAgent8 * ICDMLinkTransmitter * IIDMEFSAgent2 * IIDMEFSAgent * ICDMLinkTransmitter2 * IIDMIEHlprObj * IIDMEFSAgent3 * IIDMHelperLinksStorage * IIDMEFSAgent7 * IDMan(位置HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\...)
↑
💬 评论