# Adobe 禁止联网工具 v19 - 防火墙 + hosts 整合版(单文件) [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $Host.UI.RawUI.WindowTitle = "Adobe 禁止联网工具 v19" $principal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { if ($PSCommandPath) { Write-Host "正在申请管理员权限..." -ForegroundColor Yellow Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" } else { Write-Host "请以管理员身份运行 PowerShell 后再执行。" -ForegroundColor Red } return } function Enable-Firewall { Write-Host "正在检查 Windows 防火墙状态..." -ForegroundColor Cyan try { Set-Service -Name MpsSvc -StartupType Automatic -ErrorAction SilentlyContinue } catch {} try { Start-Service -Name MpsSvc -ErrorAction SilentlyContinue } catch {} & netsh advfirewall set allprofiles state on | Out-Null $state = & netsh advfirewall show allprofiles state Write-Host $state if ($state -match "OFF|关闭") { Write-Host "警告:防火墙仍未开启,规则将不生效。请在控制面板里启用防火墙。" -ForegroundColor Red } else { Write-Host "防火墙已开启,规则将生效。" -ForegroundColor Green } } function Disable-Firewall { Write-Host "正在关闭 Windows 防火墙(所有配置文件)..." -ForegroundColor Cyan & netsh advfirewall set allprofiles state off | Out-Null $state = & netsh advfirewall show allprofiles state Write-Host $state if ($state -match "ON|开启|启用") { Write-Host "警告:防火墙仍未关闭,可能被组策略或第三方软件接管。" -ForegroundColor Red } else { Write-Host "防火墙已关闭。注意:关闭后所有防火墙规则(包括 Adobe 禁止联网规则)都不生效。" -ForegroundColor Yellow } } $HostsPath = "$env:SystemRoot\System32\drivers\etc\hosts" $BackupPath = "$env:SystemRoot\System32\drivers\etc\hosts.bak-BlockAdobe" $StartMark = "# === BlockAdobe Start ===" $EndMark = "# === BlockAdobe End ===" $script:HostsFullDomains = @( "activate.adobe.com", "practivate.adobe.com", "genuine.adobe.com", "prod.adobegenuine.com", "ic.adobe.io", "adobe.io", "cc-api-data.adobe.io", "lcs-cops.adobe.io", "lcs-robs.adobe.io", "auth.adobe.io", "adobelogin.com", "ims-na1.adobelogin.com", "ims-na1-prprod.adobelogin.com", "ims-prod06.adobelogin.com", "ims-prod07.adobelogin.com", "ims-prod08.adobelogin.com", "ims-prod09.adobelogin.com", "ims-prod10.adobelogin.com", "adobeid-na1.services.adobe.com", "na1r.services.adobe.com", "na2m.services.adobe.com", "na4r.services.adobe.com", "lm.licenses.adobe.com", "lmlicenses.wip4.adobe.com", "lmlicenses.wip1.adobe.com", "lmlicenses.wip2.adobe.com", "lmlicenses.wip3.adobe.com", "license.adobe.com", "licenses.adobe.com", "licence.adobe.com", "licences.adobe.com", "3dns.adobe.com", "3dns-1.adobe.com", "3dns-2.adobe.com", "3dns-3.adobe.com", "3dns-4.adobe.com", "3dns-5.adobe.com", "t3dns.adobe.com", "adobe-dns.adobe.com", "adobe-dns-1.adobe.com", "adobe-dns-2.adobe.com", "adobe-dns-3.adobe.com", "adobe-dns-4.adobe.com", "adobe-dns.adobe.de", "adobe-dns-1.adobe.de", "adobe-dns-2.adobe.de", "adobe-dns-3.adobe.de", "adobe-dns-4.adobe.de", "adobe-dns.com", "adobe-dns-1.com", "adobe-dns-2.com", "adobe-dns-3.com", "adobe-dns-4.com", "wip.adobe.com", "wip1.adobe.com", "wip2.adobe.com", "wip3.adobe.com", "wip4.adobe.com", "ereg.adobe.com", "ereg.wip.adobe.com", "ereg.wip1.adobe.com", "ereg.wip2.adobe.com", "ereg.wip3.adobe.com", "ereg.wip4.adobe.com", "activate.wip.adobe.com", "activate.wip1.adobe.com", "activate.wip2.adobe.com", "activate.wip3.adobe.com", "activate.wip4.adobe.com", "activate-sea.adobe.com", "activate-sjc0.adobe.com", "activate.adobe.de", "activate-sea.adobe.de", "activate-sjc0.adobe.de", "hl2rcv.adobe.com", "adobeereg.com", "www.adobeereg.com", "oobe.adobe.com", "prod-rel-ffc-ccm.oobesaas.adobe.com", "ccmdls.adobe.com", "cmdls.adobe.com", "ereport.adobe.com", "assets.adobedtm.com", "adobe.demdex.net", "adobedc.demdex.net", "adobe.tt.omtrdc.net", "adobe.com", "www.adobe.com", "experience.adobe.com", "lms-prod.adobe.com", "na2m-pr.licenses.adobe.com", "na2m-stg2.licenses.adobe.com", "uds.licenses.adobe.com", "practivate.adobe", "practivate.adobe.ipp", "practivate.adobe.ntp", "practivate.adobe.newoa", "ood.opsource.net", "s-2.adobe.com", "s-3.adobe.com", "cc-api-data-stage.adobe.io", "api.adobe.io", "platform.adobe.io", "auth-cloudfront.prod.ims.adobejanus.com", "ims.adobejanus.com", "cdn-ffc.oobesaas.adobe.com", "ffc.oobesaas.adobe.com", "api.cc.adobe.com", "cc.adobe.com", "creativecloud.adobe.com", "genuine.adobe.io", "activate.wip3.adobe.de", "ereg.adobe.de", "hl2rcv.adobe.de", "practivate.adobe.de" ) function Backup-Hosts { if (-not (Test-Path $BackupPath)) { Copy-Item $HostsPath $BackupPath -Force Write-Host "已备份 hosts 到 $BackupPath" -ForegroundColor Green } } function Remove-Block { $content = Get-Content $HostsPath -ErrorAction SilentlyContinue if (-not $content) { return } $out = New-Object System.Collections.Generic.List[string] $skip = $false foreach ($line in $content) { if ($line -eq $StartMark) { $skip = $true; continue } if ($line -eq $EndMark) { $skip = $false; continue } if (-not $skip) { $out.Add($line) } } Set-Content -Path $HostsPath -Value $out -Encoding ASCII -Force } function Add-Block { param([string[]]$DomainList) Backup-Hosts Remove-Block $block = New-Object System.Collections.Generic.List[string] $block.Add("") $block.Add($StartMark) foreach ($d in $DomainList) { $block.Add("0.0.0.0 $d") } $block.Add($EndMark) Add-Content -Path $HostsPath -Value $block -Encoding ASCII -Force Write-Host "已添加 $($DomainList.Count) 个 Adobe 域名屏蔽到 hosts。" -ForegroundColor Green } function Flush-Dns { & ipconfig /flushdns | Out-Null try { Clear-DnsClientCache -ErrorAction SilentlyContinue } catch {} Write-Host "已刷新 DNS 缓存。" -ForegroundColor Green } function Disable-AdobeBackground { Write-Host "正在禁用 Adobe 后台服务和计划任务..." -ForegroundColor Cyan $svcNames = @("AGSService","Adobe Genuine Software Integrity Service","AdobeUpdateService","AdobeARMservice") foreach ($n in $svcNames) { $svc = Get-Service -Name $n -ErrorAction SilentlyContinue if ($svc) { try { Stop-Service -Name $n -Force -ErrorAction SilentlyContinue } catch {} try { Set-Service -Name $n -StartupType Disabled -ErrorAction SilentlyContinue; Write-Host "已禁用服务: $n" } catch {} } } try { Get-ScheduledTask -ErrorAction SilentlyContinue | Where-Object { $_.TaskName -like "*Adobe*" } | ForEach-Object { try { Disable-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath -ErrorAction SilentlyContinue | Out-Null; Write-Host "已禁用计划任务: $($_.TaskName)" } catch {} } } catch {} } function Enable-AdobeBackground { Write-Host "正在恢复 Adobe 后台服务和计划任务..." -ForegroundColor Cyan $svcNames = @("AGSService","Adobe Genuine Software Integrity Service","AdobeUpdateService","AdobeARMservice") foreach ($n in $svcNames) { $svc = Get-Service -Name $n -ErrorAction SilentlyContinue if ($svc) { try { Set-Service -Name $n -StartupType Manual -ErrorAction SilentlyContinue; Write-Host "已恢复服务为手动: $n" } catch {} } } try { Get-ScheduledTask -ErrorAction SilentlyContinue | Where-Object { $_.TaskName -like "*Adobe*" } | ForEach-Object { try { Enable-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath -ErrorAction SilentlyContinue | Out-Null; Write-Host "已恢复计划任务: $($_.TaskName)" } catch {} } } catch {} } $script:ExeNames = @( "Photoshop.exe","Illustrator.exe","AfterFX.exe","Premiere.exe","Adobe Premiere Pro.exe", "InDesign.exe","Lightroom.exe","Lightroom Classic.exe","Audition.exe","Dreamweaver.exe", "Acrobat.exe","AcroRd32.exe","Acrobat Reader.exe","Bridge.exe","Media Encoder.exe","Adobe Media Encoder.exe", "Animate.exe","Character Animator.exe","Dimension.exe","XD.exe","Fresco.exe","Prelude.exe", "Creative Cloud.exe","Adobe Creative Cloud.exe","CCXProcess.exe","Adobe Desktop Service.exe", "AdobeGCClient.exe","AdobeIPCBroker.exe","AdobeUpdateService.exe","AdobeARM.exe","AdobeNotificationClient.exe", "CoreSync.exe","Creative Cloud Helper.exe","Adobe CEF Helper.exe","AdobeCollabSync.exe", "LogTransport.exe","AdobeLogTransport.exe","PDApp.exe","Set-up.exe","Adobe Application Manager.exe" ) function Add-DefaultCDirs($found) { $defaults = @( "C:\Program Files\Adobe", "C:\Program Files (x86)\Adobe", "C:\Program Files\Common Files\Adobe", "C:\Program Files (x86)\Common Files\Adobe", "C:\ProgramData\Adobe" ) foreach ($dir in $defaults) { if (Test-Path $dir) { Get-ChildItem -Path $dir -Recurse -Filter *.exe -ErrorAction SilentlyContinue -Force | ForEach-Object { [void]$found.Add($_.FullName) } } } # 每个用户的 AppData Get-ChildItem -Path "C:\Users" -Directory -ErrorAction SilentlyContinue | ForEach-Object { foreach ($sub in @("AppData\Local\Adobe","AppData\Roaming\Adobe")) { $p = Join-Path $_.FullName $sub if (Test-Path $p) { Get-ChildItem -Path $p -Recurse -Filter *.exe -ErrorAction SilentlyContinue -Force | ForEach-Object { [void]$found.Add($_.FullName) } } } } } function Add-RegistryAndServices($found) { Write-Host "正在从注册表和服务查找 Adobe..." -ForegroundColor Cyan $regPaths = @( "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" ) foreach ($rp in $regPaths) { Get-ItemProperty $rp -ErrorAction SilentlyContinue | Where-Object { $_.Publisher -like "*Adobe*" -or $_.DisplayName -like "*Adobe*" -or $_.DisplayName -like "*Photoshop*" -or $_.DisplayName -like "*Premiere*" -or $_.DisplayName -like "*Illustrator*" -or $_.DisplayName -like "*Lightroom*" -or $_.DisplayName -like "*Acrobat*" } | ForEach-Object { if ($_.InstallLocation -and (Test-Path $_.InstallLocation)) { Get-ChildItem -Path $_.InstallLocation -Recurse -Filter *.exe -ErrorAction SilentlyContinue | ForEach-Object { [void]$found.Add($_.FullName) } } if ($_.DisplayIcon -and $_.DisplayIcon -match '^[A-Za-z]:\\') { $iconPath = ($_.DisplayIcon -split ',')[0].Trim('"') if (Test-Path $iconPath) { [void]$found.Add($iconPath) } } } } try { Get-WmiObject Win32_Service -ErrorAction SilentlyContinue | Where-Object { $_.PathName -match "Adobe" } | ForEach-Object { if ($_.PathName -match '"([^"]+\.exe)"') { if (Test-Path $Matches[1]) { [void]$found.Add($Matches[1]) } } elseif ($_.PathName -match '^([A-Za-z]:\\[^\s]+\.exe)') { if (Test-Path $Matches[1]) { [void]$found.Add($Matches[1]) } } } } catch {} Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.Path -and $_.Path -match "Adobe" } | ForEach-Object { [void]$found.Add($_.Path) } } function Get-AdobeExeList { param([string]$Mode, [string[]]$Roots) $found = New-Object System.Collections.Generic.HashSet[string] if ($Mode -eq "default") { # 默认扫描(前面版本方式):只扫 C 盘 Adobe 默认目录 Write-Host "默认扫描:只扫描 C 盘 Adobe 默认目录..." -ForegroundColor Cyan Add-DefaultCDirs $found } elseif ($Mode -eq "dir") { # 手动目录:该目录下所有 exe 都拦 + C盘默认 Adobe 组件 foreach ($root in $Roots) { Write-Host "扫描目录 $root ..." -ForegroundColor DarkCyan Get-ChildItem -Path $root -Recurse -Filter *.exe -ErrorAction SilentlyContinue -Force | ForEach-Object { [void]$found.Add($_.FullName) } } Write-Host "同时扫描 C 盘默认 Adobe 组件..." -ForegroundColor Cyan Add-DefaultCDirs $found Add-RegistryAndServices $found } elseif ($Mode -eq "drive") { Add-RegistryAndServices $found foreach ($root in $Roots) { Write-Host "扫描 $root ..." -ForegroundColor DarkCyan Get-ChildItem -Path $root -Recurse -Filter *.exe -ErrorAction SilentlyContinue -Force | Where-Object { $_.FullName -match '\\Adobe\\' -or $script:ExeNames -contains $_.Name } | ForEach-Object { [void]$found.Add($_.FullName) } } } else { # 全盘 Add-RegistryAndServices $found Write-Host "正在全盘扫描(可能需要几分钟,请耐心等待)..." -ForegroundColor Cyan $drives = Get-PSDrive -PSProvider FileSystem -ErrorAction SilentlyContinue | Where-Object { $_.Root -match '^[A-Za-z]:\\$' } foreach ($d in $drives) { Write-Host "扫描 $($d.Root) ..." -ForegroundColor DarkCyan Get-ChildItem -Path $d.Root -Recurse -Filter *.exe -ErrorAction SilentlyContinue -Force | Where-Object { $_.FullName -match '\\Adobe\\' -or $script:ExeNames -contains $_.Name } | ForEach-Object { [void]$found.Add($_.FullName) } } } return @($found) } function Uninstall-AgsService { Write-Host "正在扫描 AGS 服务..." -ForegroundColor Cyan $svcNames = @("AGSService", "Adobe Genuine Software Integrity Service") $found = @() foreach ($n in $svcNames) { $svc = Get-Service -Name $n -ErrorAction SilentlyContinue if ($svc) { $found += $svc; Write-Host "发现服务: $($svc.Name) ($($svc.DisplayName)) 状态: $($svc.Status)" } } if ($found.Count -eq 0) { Write-Host "未发现 AGS 服务,无需卸载。" -ForegroundColor Green return } foreach ($svc in $found) { try { Stop-Service -Name $svc.Name -Force -ErrorAction SilentlyContinue } catch {} } $uninstallCmd = $null $regPaths = @("HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*") foreach ($rp in $regPaths) { Get-ItemProperty $rp -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like "*Adobe Genuine*" -or $_.DisplayName -like "*AGS*" } | ForEach-Object { if ($_.UninstallString) { $uninstallCmd = $_.UninstallString } if ($_.QuietUninstallString) { $uninstallCmd = $_.QuietUninstallString } } } if ($uninstallCmd) { Write-Host "找到卸载命令,正在卸载: $uninstallCmd" -ForegroundColor Cyan $exe = $null; $argList = "" if ($uninstallCmd -match '^\s*"([^"]+)"\s*(.*)$') { $exe = $Matches[1]; $argList = $Matches[2] } elseif ($uninstallCmd -match '^\s*(\S+)\s*(.*)$') { $exe = $Matches[1]; $argList = $Matches[2] } if ($exe -and (Test-Path $exe)) { try { if ($argList) { Start-Process -FilePath $exe -ArgumentList $argList -Wait -ErrorAction SilentlyContinue } else { Start-Process -FilePath $exe -Wait -ErrorAction SilentlyContinue } } catch {} } else { Write-Host "卸载程序不存在: $exe,将直接删除服务。" -ForegroundColor Yellow } } else { Write-Host "未找到卸载命令,将直接删除服务。" -ForegroundColor Yellow } foreach ($svc in $found) { $still = Get-Service -Name $svc.Name -ErrorAction SilentlyContinue if ($still) { Write-Host "服务仍存在,正在删除服务: $($svc.Name)" -ForegroundColor Cyan & sc.exe delete $svc.Name | Out-Null } } $left = @() foreach ($n in $svcNames) { if (Get-Service -Name $n -ErrorAction SilentlyContinue) { $left += $n } } if ($left.Count -eq 0) { Write-Host "AGS 服务已卸载。" -ForegroundColor Green } else { Write-Host "AGS 服务仍存在: $($left -join ', '),可能需要重启后再试。" -ForegroundColor Red } } while ($true) { Write-Host "==============================================" -ForegroundColor Green Write-Host " Adobe 禁止联网工具 v19(防火墙 + hosts 整合版)" -ForegroundColor Green Write-Host "==============================================" -ForegroundColor Green Write-Host "" Write-Host "当前防火墙状态:" -ForegroundColor Cyan & netsh advfirewall show allprofiles state Write-Host "" Write-Host "1. 扫描并卸载 AGS 服务" Write-Host "2. 禁止联网 - hosts 版(115 个域名)" Write-Host "3. 解除禁止 - hosts 版(删除屏蔽 + 恢复后台服务/任务)" Write-Host "4. 禁止联网 - 防火墙版(会自动开启防火墙)" Write-Host "5. 解除禁止 - 防火墙版" Write-Host "6. 开启 Windows 防火墙" Write-Host "7. 关闭 Windows 防火墙" Write-Host "8. 退出" Write-Host "" $choice = Read-Host "请输入选项 [1/2/3/4/5/6/7/8]" if ($choice -eq "1") { Uninstall-AgsService Write-Host "" Read-Host "按回车返回主菜单" continue } if ($choice -eq "2") { $domainList = $script:HostsFullDomains Write-Host "" Write-Host "已选:禁止联网 - hosts 版,共 $($domainList.Count) 个域名。" Add-Block -DomainList $domainList Disable-AdobeBackground Flush-Dns Write-Host "" Write-Host "完成。注意:hosts 版不如防火墙版彻底,直连 IP 或新域名可能绕过;浏览器打开 adobe.com 官网也会打不开,恢复选 3。" -ForegroundColor Green Write-Host "" Read-Host "按回车返回主菜单" continue } if ($choice -eq "3") { Remove-Block Enable-AdobeBackground Flush-Dns Write-Host "" Write-Host "已恢复 hosts。备份在 $BackupPath" -ForegroundColor Green Write-Host "" Read-Host "按回车返回主菜单" continue } if ($choice -eq "6") { Enable-Firewall Write-Host "" Read-Host "按回车返回主菜单" continue } if ($choice -eq "7") { Disable-Firewall Write-Host "" Read-Host "按回车返回主菜单" continue } if ($choice -eq "8") { Write-Host "已退出。" break } if ($choice -ne "4" -and $choice -ne "5") { Write-Host "输入无效,返回主菜单。" -ForegroundColor Yellow Read-Host "按回车返回主菜单" continue } Write-Host "" Write-Host "请选择扫描范围:" Write-Host "1. 默认扫描(只扫 C 盘 Adobe 默认目录)" Write-Host "2. 手动盘符扫描(只扫你选的盘)" Write-Host "" $scope = Read-Host "请输入选项 [1/2]" $mode = "default" $roots = @() if ($scope -eq "1") { $mode = "default" Write-Host "将默认扫描 C 盘 Adobe 默认目录(Program Files、Common Files、ProgramData、AppData)。" } elseif ($scope -eq "2") { $mode = "drive" $drives = Get-PSDrive -PSProvider FileSystem -ErrorAction SilentlyContinue | Where-Object { $_.Root -match '^[A-Za-z]:\\$' } Write-Host "当前盘符:$($drives.Root -join ' ')" $inputDrives = Read-Host "请输入盘符,多个用空格隔开,如 D 或 C D E" foreach ($tok in ($inputDrives -split '[\s,,;;]+')) { if (-not $tok) { continue } $letter = $tok.Trim().TrimEnd(':','\').ToUpper() if ($letter.Length -eq 1 -and $letter -match '[A-Z]') { $root = "${letter}:\" if (Test-Path $root) { $roots += $root } else { Write-Host "盘符不存在:$root" -ForegroundColor Red } } } if ($roots.Count -eq 0) { Write-Host "没有有效的盘符,返回主菜单。" -ForegroundColor Red; Read-Host "按回车返回主菜单"; continue } Write-Host "将扫描:$($roots -join ' ')" } else { Write-Host "输入无效,返回主菜单。" -ForegroundColor Yellow Read-Host "按回车返回主菜单" continue } $list = Get-AdobeExeList -Mode $mode -Roots $roots Write-Host "" if ($choice -eq "4") { Enable-Firewall Write-Host "共找到 $($list.Count) 个 Adobe 程序,正在添加规则..." -ForegroundColor Yellow $i = 0 foreach ($exe in $list) { $i++ $name = [System.IO.Path]::GetFileNameWithoutExtension($exe) Write-Host "[$i] 正在禁止: $exe" & netsh advfirewall firewall add rule name="BlockAdobe_${i}_$name" dir=out action=block program="$exe" enable=yes profile=any | Out-Null } Disable-AdobeBackground Write-Host "" Write-Host "完成,共禁止 $i 个程序联网。" -ForegroundColor Green Write-Host "提示:以后安装或更新 Adobe 软件后,再运行一次选 4 即可。" } else { Write-Host "共找到 $($list.Count) 个 Adobe 程序,正在删除规则..." -ForegroundColor Yellow $i = 0 foreach ($exe in $list) { $i++ Write-Host "[$i] 正在解除: $exe" & netsh advfirewall firewall delete rule name=all dir=out program="$exe" | Out-Null } Enable-AdobeBackground Write-Host "" Write-Host "完成,规则已删除。" -ForegroundColor Green } Write-Host "" Read-Host "按回车返回主菜单" }