惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
B
Blog
L
LangChain Blog
Y
Y Combinator Blog
美团技术团队
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
量子位
博客园_首页
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Check Point Blog
D
Docker
小众软件
小众软件
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
IT之家
IT之家

Anyeの小站

PlayGuard,让你的播放器老实点! Peg - 命令行便签 · 把终端输出钉上布告板 2025 年终总结:折腾不止,热情常青 告别公网暴露风险:mTLS助你构建家里云安全边界 🚀 0 代码部署:Halo 博客与企业门户系统 B站跟随系统深色模式脚本——让你的B站体验更丝滑 【1024抽奖】EdgeOne下线源站防护?这个办法更简单! 混元模型玩家必看:CNB API 不限量调用! 1Panel 应用商店如何上架应用 Next Terminal 实战:内网无密码安全登录 用了 EdgeOne 降本增效,源站却可能裸奔? 降本增效!上云真香! 在线重装 Proxmox VE SSL证书申请老出问题?这套组合直接帮你搞定! 🌐 森屿云:让数字化转型像呼吸一样自然 1Panel v2 首发体验(alpha) Vscode/Code-Server 安装中文包——CI/CD DockerHub Mirror 终极解决方案——零成本,速度超快! 本地跑不动 QwQ?快用 CNB,免费运行满血 QwQ! Docker Push 巨慢?Skopeo 来拯救 2024 年终总结:与 17170 位读者相遇的旅程 云厂 200Mbps 小鸡,家里云的希望 Halo 插件 thyuu-embed 主题样式注入模板 Windows 11 卸载 Edge 小破站 6 级萌新前来挑战硬核会员,答题分享 手机系统杂谈 1Panel 自建邮局 - Docker Mailserver 1Panel 推送 SSL 证书到阿里云、腾讯云 整了几个简洁的单页,欢迎来扒 1Panel 部署 Logto 对接自有平台
全新!Edge 还是卸载不掉?来试试这个!
Anye · 2025-09-26 · via Anyeの小站

前言

之前写过一篇 https://www.anye.xyz/archives/IuHBJWtU,今天又试了一下,感觉还是太复杂,无论是进入 PE 还是使用 Live CD 都提高了操作难度,经过时间发现当前版本下 ViVeTool 也不是必须的,那么就写个脚本来一键启用 Edge 的卸载功能吧!

启用卸载功能脚本

右键 开始 按钮,打开 终端管理员 ,复制下面的代码粘贴进去即可。

# ============================================
# 启用卸载功能脚本(含备份)
# ============================================

$jsonPath = "C:\Windows\System32\IntegratedServicesRegionPolicySet.json"
$backupPath = "C:\Windows\System32\IntegratedServicesRegionPolicySet.json.bak"

# -------------------------------
# 1. 检查管理员权限
# -------------------------------
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
    Write-Error "请以管理员身份运行此 PowerShell"
    exit
}

# -------------------------------
# 2. 取得文件所有权
# -------------------------------
Write-Host "获取文件所有权..."
takeown /f $jsonPath
icacls $jsonPath /grant administrators:F

# -------------------------------
# 3. 备份原文件
# -------------------------------
Write-Host "备份原文件到 $backupPath"
$backupDir = Split-Path $backupPath
if (-not (Test-Path $backupDir)) { New-Item -ItemType Directory -Path $backupDir -Force }
Copy-Item -Path $jsonPath -Destination $backupPath -Force

# -------------------------------
# 4. 读取 JSON 并修改 policies 数组
# -------------------------------
Write-Host "读取并修改 JSON 文件..."
$jsonContent = Get-Content $jsonPath -Raw | ConvertFrom-Json

# 从注册表获取当前地理位置代码
$geoCode = (Get-ItemProperty -Path 'Registry::HKEY_USERS\.DEFAULT\Control Panel\International\Geo' -Name Name).Name
Write-Host "当前注册表 Geo 地区代码:$geoCode"

# 遍历 policies 数组
foreach ($policy in $jsonContent.policies) {
    if ($policy.'$comment' -eq 'Edge is uninstallable.') {
        # 修改 defaultState
        $policy.defaultState = 'enabled'

        # 修改 enabled 数组,加入注册表获取的地区代码
        $enabledArray = $policy.conditions.region.enabled
        if (-not ($enabledArray -contains $geoCode)) {
            $enabledArray = @($geoCode) + $enabledArray
        }
        $policy.conditions.region.enabled = $enabledArray

        Write-Host "修改完成:$($policy.'$comment')"
    }
}

# 保存回文件
$jsonContent | ConvertTo-Json -Depth 10 | Set-Content $jsonPath -Encoding UTF8

# -------------------------------
# 5. 恢复 TrustedInstaller 权限
# -------------------------------
Write-Host "恢复 TrustedInstaller 权限..."
icacls $jsonPath /setowner "NT SERVICE\TrustedInstaller"
icacls $jsonPath /grant:r "NT SERVICE\TrustedInstaller:(F)" /inheritance:e

Write-Host "操作完成,原文件已备份到 $backupPath"

# -------------------------------
# 6. 修改注册表,允许 Edge 可卸载
# -------------------------------
Write-Host "修改注册表:允许 Microsoft Edge 可卸载..."
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /v NoRemove /t REG_DWORD /d 0 /f

执行结束后重启电脑,就可以直接在控制面板或者是 Edge 右键卸载亦或是其他工具中正常卸载 Edge 了!

(可选)恢复备份脚本

这一步非必须,对系统不会造成实质性影响,可选恢复原 IntegratedServicesRegionPolicySet.json 配置文件来寻求心理安慰。

# ============================================
# 恢复 IntegratedServicesRegionPolicySet.json 备份脚本
# ============================================

# 原文件路径
$jsonPath = "C:\Windows\System32\IntegratedServicesRegionPolicySet.json"
# 备份文件路径
$backupPath = "C:\Windows\System32\IntegratedServicesRegionPolicySet.json.bak"

# -------------------------------
# 1. 检查管理员权限
# -------------------------------
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
    Write-Error "请以管理员身份运行此 PowerShell"
    exit
}

# -------------------------------
# 2. 取得文件所有权(防止拒绝访问)
# -------------------------------
Write-Host "获取文件所有权..."
takeown /f $jsonPath
icacls $jsonPath /grant administrators:F

# -------------------------------
# 3. 恢复备份文件
# -------------------------------
if (Test-Path $backupPath) {
    Write-Host "恢复备份文件..."
    Copy-Item -Path $backupPath -Destination $jsonPath -Force
    Write-Host "备份文件已恢复到 $jsonPath"

    # 删除备份文件
    Remove-Item -Path $backupPath -Force
    Write-Host "备份文件已删除:$backupPath"
} else {
    Write-Error "备份文件不存在:$backupPath"
    exit
}

# -------------------------------
# 4. 恢复 TrustedInstaller 权限
# -------------------------------
Write-Host "恢复 TrustedInstaller 权限..."
icacls $jsonPath /setowner "NT SERVICE\TrustedInstaller"
icacls $jsonPath /grant:r "NT SERVICE\TrustedInstaller:(F)" /inheritance:e

Write-Host "操作完成,权限已恢复为 TrustedInstaller"

后记

大哥们,球球别问我卸载了 Edge 用什么浏览器了~