安装 WebView2 后剥离其中的捆绑组件

安装 WebView2 后剥离其中的捆绑组件

背景

Microsoft Edge WebView2 是 Windows 上广泛使用的嵌入式浏览器控件运行时。许多桌面应用(Electron 替代方案、.NET WPF/WinForms 应用等)依赖它来渲染 Web 内容。

然而,微软在 WebView2 Runtime 的安装包中捆绑了大量非运行必需的组件,包括:

  • Copilot ------ 微软 AI 助手的完整可执行文件、安装器、87 种语言本地化资源、图标、身份代理
  • EdgeUpdate ------ 后台常驻更新服务、计划任务、COM 注册表项
  • SetupMetrics ------ 安装遥测指标收集
  • Identity Proxy ------ Edge 浏览器 Microsoft 账号登录代理
  • uc_connector ------ Edge 云端同步桥接器
  • WNS Push Client ------ Windows 推送通知服务客户端
  • WDAG ------ Windows Defender Application Guard 沙箱支持

这些组件对 WebView2 作为嵌入式控件的正常运行没有功能贡献,却占用磁盘空间、常驻后台进程、开放网络通信端口,并可能收集遥测数据。

问题量化

通过文件系统安装监控,我在一次 WebView2 Runtime 148.0.3967.70 的安装中记录到 1,249 个文件变更,经逐项分析:

组件类别 文件数 性质
Copilot 捆绑 580 独立产品,零运行依赖
EdgeCore 冗余目录 244 完整 Edge 浏览器核心副本
EdgeUpdate 服务 1 + 2 服务 + 2 任务 + ~80 注册表项 后台常驻进程
Identity Proxy ~30 浏览器身份认证代理
SetupMetrics 遥测 1 安装指标收集
WNS 推送客户端 2 推送通知通道
WDAG 沙箱 2 企业沙箱隔离
Vulkan/SwiftShader ~6 建议保留(软件渲染回退)
WidevineCdm ~9 建议保留(DRM 播放)

其中 Copilot 占比 46%,是最大的非必要组件来源。

保留什么、移除什么

这是一个需要谨慎判断的问题。我的原则是:

必须移除(100% 非运行必需)

  1. Copilot 全部 ------ 独立 AI 产品,与嵌入式浏览器控件无关
  2. EdgeUpdate 服务 ------ WebView2 应用可通过自身 bootstrapper 管理版本
  3. SetupMetrics 遥测 ------ 纯安装指标收集,无运行时功能

强烈建议移除(99% 不需要)

  1. Identity Proxy ------ 为 Edge 浏览器账号登录设计,WebView2 不涉及
  2. uc_connector ------ Edge 云端同步功能,WebView2 不使用
  3. WNS Push Client ------ Edge 推送通知通道,WebView2 应用自行处理通知
  4. WDAG ------ 企业策略沙箱,WebView2 应用几乎不调用

建议保留

  • Vulkan / SwiftShader ------ 无 GPU / 远程桌面环境下可能依赖软件渲染回退
  • WidevineCdm ------ 如应用需要播放 DRM 保护内容则必须保留
  • Trust Protection Lists ------ 如应用启用 Edge Tracking Prevention 则需要

脚本实现

基于以上分析,我编写了 Remove-WebView2Bloatware.ps1,完整处理以下 7 个步骤:

csharp 复制代码
[1/7] Copilot 捆绑软件 → mscopilot.exe, copilot_setup.exe, Copilot.dat, Overlay 资源包,
      87 种语言本地化, 图标目录, Copilot Identity Proxy
[2/7] EdgeUpdate 服务   → edgeupdatem/edgeupdate 服务, 计划任务, 目录, ~80 个注册表项, 防火墙规则
[3/7] SetupMetrics 遥测 → SetupMetrics 目录
[4/7] Identity Proxy    → identity_proxy 整目录 + ResiliencyLinks 副本
[5/7] uc_connector      → uc_connector.exe
[6/7] WNS 推送          → wns_push_client.dll + ResiliencyLinks 副本
[7/7] WDAG 沙箱         → wdag.dll + ResiliencyLinks 副本

完整代码

powershell 复制代码
<#
.SYNOPSIS
    移除 Microsoft Edge WebView2 安装中捆绑的非必要组件
.DESCRIPTION
    强制删除以下非 WebView2 核心运行必需的组件:
      1. Copilot 全部(可执行文件、UI资源、本地化、图标、身份代理)
      2. EdgeUpdate 自动更新服务(服务、计划任务、可执行文件、注册表)
      3. SetupMetrics 遥测模块
      4. Identity Proxy 全部(Edge 浏览器身份代理 + Copilot 身份代理)
      5. uc_connector.exe
      6. WNS 推送通知客户端
      7. WDAG 沙箱支持
.NOTES
    必须以管理员权限运行。
    建议在运行前创建系统还原点。
#>

#Requires -RunAsAdministrator

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Continue'

$EdgeWebViewRoot = "${env:ProgramFiles(x86)}\Microsoft\EdgeWebView"
$EdgeCoreRoot    = "${env:ProgramFiles(x86)}\Microsoft\EdgeCore"
$EdgeUpdateRoot  = "${env:ProgramFiles(x86)}\Microsoft\EdgeUpdate"

$logDir  = Split-Path -Parent $MyInvocation.MyCommand.Path
$logFile = Join-Path $logDir "Remove-Bloatware_$(Get-Date -Format 'yyyy-MM-dd_HH-mm-ss').log"

function Write-Log {
    param([string]$Message)
    $ts = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
    $line = "[$ts] $Message"
    Write-Host $line
    Add-Content -Path $logFile -Value $line -Encoding UTF8
}

function Remove-ItemForce {
    param([string]$Path)
    if (Test-Path $Path) {
        try {
            Remove-Item -Path $Path -Recurse -Force -ErrorAction Stop
            Write-Log "  [OK] 已删除: $Path"
            return $true
        } catch {
            try {
                cmd.exe /c "takeown /f `"$Path`" /a" 2>$null | Out-Null
                cmd.exe /c "icacls `"$Path`" /grant Administrators:F /t /q" 2>$null | Out-Null
                Remove-Item -Path $Path -Recurse -Force -ErrorAction Stop
                Write-Log "  [OK] 已删除(提权): $Path"
                return $true
            } catch {
                Write-Log "  [FAIL] 无法删除: $Path - $($_.Exception.Message)"
                return $false
            }
        }
    } else {
        Write-Log "  [SKIP] 不存在: $Path"
        return $false
    }
}

function Stop-AndRemoveService {
    param([string]$Name)
    $svc = Get-Service -Name $Name -ErrorAction SilentlyContinue
    if ($svc) {
        try {
            Stop-Service -Name $Name -Force -ErrorAction Stop
            Write-Log "  [OK] 已停止服务: $Name"
        } catch {
            Write-Log "  [WARN] 停止服务失败: $Name - $($_.Exception.Message)"
        }
        try {
            sc.exe delete $Name 2>$null | Out-Null
            Write-Log "  [OK] 已删除服务: $Name"
        } catch {
            Write-Log "  [FAIL] 删除服务失败: $Name"
        }
    } else {
        Write-Log "  [SKIP] 服务不存在: $Name"
    }
}

function Remove-ScheduledTask {
    param([string]$TaskPath, [string]$TaskName)
    $task = Get-ScheduledTask -TaskPath $TaskPath -TaskName $TaskName -ErrorAction SilentlyContinue
    if ($task) {
        try {
            Unregister-ScheduledTask -TaskPath $TaskPath -TaskName $TaskName -Confirm:$false -ErrorAction Stop
            Write-Log "  [OK] 已删除计划任务: ${TaskPath}${TaskName}"
        } catch {
            schtasks.exe /delete /tn "${TaskPath}${TaskName}" /f 2>$null | Out-Null
            Write-Log "  [OK] 已删除计划任务(schtasks): ${TaskPath}${TaskName}"
        }
    } else {
        Write-Log "  [SKIP] 计划任务不存在: ${TaskPath}${TaskName}"
    }
}

function Remove-RegistryKey {
    param([string]$Key)
    try {
        if (Test-Path $Key) {
            Remove-Item -Path $Key -Recurse -Force -ErrorAction Stop
            Write-Log "  [OK] 已删除注册表: $Key"
        } else {
            Write-Log "  [SKIP] 注册表不存在: $Key"
        }
    } catch {
        try {
            $hive = $Key.Split('\')[0]
            $subKey = $Key.Substring($hive.Length + 1)
            $h = switch ($hive) {
                'HKEY_CLASSES_ROOT'                  { 'HKCR:\' }
                'HKEY_LOCAL_MACHINE'                 { 'HKLM:\' }
                'HKEY_CURRENT_USER'                  { 'HKCU:\' }
                default { $null }
            }
            if ($h) {
                cmd.exe /c "reg delete `"$Key`" /f" 2>$null | Out-Null
                Write-Log "  [OK] 已删除注册表(reg): $Key"
            }
        } catch {
            Write-Log "  [FAIL] 无法删除注册表: $Key - $($_.Exception.Message)"
        }
    }
}

# =====================================================================
# 主流程
# =====================================================================

Write-Log "============================================================"
Write-Log "WebView2 非必要组件移除脚本 - 开始执行"
Write-Log "============================================================"

# ---------------------------------------------------------------
# 1. Copilot 捆绑软件
# ---------------------------------------------------------------
Write-Log ""
Write-Log "[1/7] 移除 Copilot 捆绑软件..."

$versionDirs = @()
if (Test-Path $EdgeWebViewRoot) {
    $v = Get-ChildItem "$EdgeWebViewRoot\Application" -Directory -ErrorAction SilentlyContinue |
         Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
         Sort-Object Name -Descending | Select-Object -First 1
    if ($v) { $versionDirs += $v.FullName }
}
if (Test-Path $EdgeCoreRoot) {
    $v = Get-ChildItem $EdgeCoreRoot -Directory -ErrorAction SilentlyContinue |
         Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
         Sort-Object Name -Descending | Select-Object -First 1
    if ($v) { $versionDirs += $v.FullName }
}

foreach ($vDir in $versionDirs) {
    Write-Log "  处理版本目录: $vDir"

    # Copilot 可执行文件
    Remove-ItemForce "$vDir\mscopilot.exe"
    Remove-ItemForce "$vDir\Copilot.dat"

    # Copilot 安装器
    Remove-ItemForce "$vDir\Installer\copilot_setup.exe"

    # Copilot Overlay UI 资源包
    Remove-ItemForce "$vDir\copilot_overlay_unscaled_images.pak"
    Remove-ItemForce "$vDir\copilot_overlay_images_200_percent.pak"
    Remove-ItemForce "$vDir\copilot_overlay_images_100_percent.pak"

    # Copilot 图标目录
    Remove-ItemForce "$vDir\VisualElements\CopilotStable"
    Remove-ItemForce "$vDir\VisualElements\CopilotDev"

    # Copilot 散落图标
    foreach ($f in @('LogoCopilot.png','SmallLogoCopilot.png','LogoCopilotDev.png','SmallLogoCopilotDev.png')) {
        Remove-ItemForce "$vDir\VisualElements\$f"
    }

    # Copilot 本地化字符串 (Locales 目录下 copilot_overlay_strings_*.pak 和 .pak.DATA)
    $localesDir = "$vDir\Locales"
    if (Test-Path $localesDir) {
        Get-ChildItem $localesDir -Filter "copilot_overlay_strings_*" -ErrorAction SilentlyContinue |
            ForEach-Object { Remove-ItemForce $_.FullName }
    }
    $rlLocalesDir = "$vDir\ResiliencyLinks\Locales"
    if (Test-Path $rlLocalesDir) {
        Get-ChildItem $rlLocalesDir -Filter "copilot_overlay_strings_*" -ErrorAction SilentlyContinue |
            ForEach-Object { Remove-ItemForce $_.FullName }
    }

    # Copilot Identity Proxy
    foreach ($winVer in @('win10','win11')) {
        $proxyDir = "$vDir\identity_proxy\$winVer"
        if (Test-Path $proxyDir) {
            Get-ChildItem $proxyDir -Filter "copilot.identity_helper*" -ErrorAction SilentlyContinue |
                ForEach-Object { Remove-ItemForce $_.FullName }
        }
        $rlProxyDir = "$vDir\ResiliencyLinks\identity_proxy\$winVer"
        if (Test-Path $rlProxyDir) {
            Get-ChildItem $rlProxyDir -Filter "copilot.identity_helper*" -ErrorAction SilentlyContinue |
                ForEach-Object { Remove-ItemForce $_.FullName }
        }
    }
    foreach ($manifest in @(
        'stable.copilot.identity_helper.exe.manifest',
        'internal.copilot.identity_helper.exe.manifest',
        'dev.copilot.identity_helper.exe.manifest'
    )) {
        Remove-ItemForce "$vDir\identity_proxy\$manifest"
    }
}

# ---------------------------------------------------------------
# 2. EdgeUpdate 自动更新服务
# ---------------------------------------------------------------
Write-Log ""
Write-Log "[2/7] 移除 EdgeUpdate 自动更新服务..."

Stop-AndRemoveService 'edgeupdatem'
Stop-AndRemoveService 'edgeupdate'

Remove-ScheduledTask '\' 'MicrosoftEdgeUpdateTaskMachineUA{0E071B78-2EE3-457D-B5F1-0429F5B16E2A}'
Remove-ScheduledTask '\' 'MicrosoftEdgeUpdateTaskMachineCore{A2EEE262-4749-489B-9DB3-88835549645F}'

Remove-ItemForce $EdgeUpdateRoot

# EdgeUpdate 注册表 - 程序注册表项
$edgeUpdateRegKeys = @(
    'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update',
    'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MicrosoftEdgeUpdate.exe',
    'HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application\edgeupdatem',
    'HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application\edgeupdate',
    'HKLM:\SYSTEM\CurrentControlSet\Services\edgeupdatem',
    'HKLM:\SYSTEM\CurrentControlSet\Services\edgeupdate'
)
foreach ($key in $edgeUpdateRegKeys) {
    if (Test-Path $key) {
        Remove-Item $key -Recurse -Force -ErrorAction SilentlyContinue
        Write-Log "  [OK] 已删除注册表: $key"
    }
}

# EdgeUpdate COM 注册表项 (HKCR)
$edgeUpdateComKeys = @(
    'MicrosoftEdgeUpdate.Update3WebSvc',
    'MicrosoftEdgeUpdate.Update3WebSvc.1.0',
    'MicrosoftEdgeUpdate.Update3WebMachineFallback',
    'MicrosoftEdgeUpdate.Update3WebMachineFallback.1.0',
    'MicrosoftEdgeUpdate.Update3WebMachine',
    'MicrosoftEdgeUpdate.Update3WebMachine.1.0',
    'MicrosoftEdgeUpdate.Update3COMClassService',
    'MicrosoftEdgeUpdate.Update3COMClassService.1.0',
    'MicrosoftEdgeUpdate.ProcessLauncher',
    'MicrosoftEdgeUpdate.ProcessLauncher.1.0',
    'MicrosoftEdgeUpdate.OnDemandCOMClassSvc',
    'MicrosoftEdgeUpdate.OnDemandCOMClassSvc.1.0',
    'MicrosoftEdgeUpdate.OnDemandCOMClassMachineFallback',
    'MicrosoftEdgeUpdate.OnDemandCOMClassMachineFallback.1.0',
    'MicrosoftEdgeUpdate.OnDemandCOMClassMachine',
    'MicrosoftEdgeUpdate.OnDemandCOMClassMachine.1.0',
    'MicrosoftEdgeUpdate.CredentialDialogMachine',
    'MicrosoftEdgeUpdate.CredentialDialogMachine.1.0',
    'MicrosoftEdgeUpdate.CoreMachineClass',
    'MicrosoftEdgeUpdate.CoreMachineClass.1',
    'MicrosoftEdgeUpdate.CoreClass',
    'MicrosoftEdgeUpdate.CoreClass.1'
)
foreach ($comKey in $edgeUpdateComKeys) {
    Remove-RegistryKey "HKEY_CLASSES_ROOT\$comKey"
}

# EdgeUpdate CLSID
$edgeUpdateClsids = @(
    '{2E1DD7EF-C12D-4F8E-8AD8-CF8CC265BAD0}',
    '{08D832B9-D2FD-481F-98CF-904D00DF63CC}',
    '{492E1C30-A1A2-4695-87C8-7A8CAD6F936F}',
    '{34EAF827-6C36-4CEF-8A9C-7C9842355641}',
    '{0DF7EDA8-24D7-4C93-AD01-5170BFAE5859}',
    '{5F6A18BB-6231-424B-8242-19E5BB94F8ED}',
    '{8F09CD6C-5964-4573-82E3-EBFF7702865B}',
    '{A2F5CB38-265F-4A02-9D1E-F25B664968AB}',
    '{A6B716CB-028B-404D-B72C-50E153DD68DA}',
    '{CECDDD22-2E72-4832-9606-A9B0E5E344B2}',
    '{D1E8B1A6-32CE-443C-8E2E-EBA90C481353}',
    '{E421557C-0628-43FB-BF2B-7C9F8A4D067C}',
    '{EA92A799-267E-4DF5-A6ED-6A7E0684BB8A}',
    '{FF419FF9-90BE-4D9F-B410-A789F90E5A7C}'
)
foreach ($clsid in $edgeUpdateClsids) {
    Remove-RegistryKey "HKEY_CLASSES_ROOT\WOW6432Node\CLSID\$clsid"
    Remove-RegistryKey "HKEY_CLASSES_ROOT\CLSID\$clsid"
}

# EdgeUpdate Interface GUIDs
$edgeUpdateInterfaces = @(
    '{FEA2518F-758F-4B95-A59F-97FCEEF1F5D0}',
    '{FCE48F77-C677-4012-8A1A-54D2E2BC07BD}',
    '{E55B90F1-DA33-400B-B09E-3AFF7D46BD83}',
    '{E4518371-7326-4865-87F8-D9D3F3B287A3}',
    '{DDD4B5D4-FD54-497C-8789-0830F29A60EE}',
    '{D9AA3288-4EA7-4E67-AE60-D18EADCB923D}',
    '{C853632E-36CA-4999-B992-EC0D408CF5AB}',
    '{C20433B3-0D4B-49F6-9B6C-6EE0FAE07837}',
    '{C06EE550-7248-488E-971E-B60C0AB3A6E4}',
    '{AB4F4A7E-977C-4E23-AD8F-626A491715DF}',
    '{A6556DFF-AB15-4DC3-A890-AB54120BEAEC}',
    '{A5135E58-384F-4244-9A5F-30FA9259413C}',
    '{9A6B447A-35E2-4F6B-A87B-5DEEBBFDAD17}',
    '{99F8E195-1042-4F89-A28C-89CDB74A14AE}',
    '{837E40DA-EB1B-440C-8623-0F14DF158DC0}',
    '{7E29BE61-5809-443F-9B5D-CF22156694EB}',
    '{7B3B7A69-7D88-4847-A6BC-90E246A41F69}',
    '{79E0C401-B7BC-4DE5-8104-71350F3A9B67}',
    '{6DFFE7FE-3153-4AF1-95D8-F8FCCA97E56B}',
    '{5F9C80B5-9E50-43C9-887C-7C6412E110DF}',
    '{450CF5FF-95C4-4679-BECA-22680389ECB9}',
    '{3E102DC6-1EDB-46A1-8488-61F71B35ED5F}',
    '{3A49F783-1C7D-4D35-8F63-5C1C206B9B6E}',
    '{2EC826CB-5478-4533-9015-7580B3B5E03A}',
    '{2603C88B-F971-4167-9DE1-871EE4A3DC84}',
    '{1B9063E4-3882-485E-8797-F28A0240782F}',
    '{195A2EB3-21EE-43CA-9F23-93C2C9934E2E}',
    '{177CAE89-4AD6-42F4-A458-00EC3389E3FE}'
)
foreach ($iid in $edgeUpdateInterfaces) {
    Remove-RegistryKey "HKEY_CLASSES_ROOT\WOW6432Node\Interface\$iid"
    Remove-RegistryKey "HKEY_CLASSES_ROOT\Interface\$iid"
}

# EdgeUpdate AppID
Remove-RegistryKey 'HKEY_CLASSES_ROOT\WOW6432Node\AppID\MicrosoftEdgeUpdate.exe'
Remove-RegistryKey 'HKEY_CLASSES_ROOT\AppID\MicrosoftEdgeUpdate.exe'
Remove-RegistryKey 'HKEY_CLASSES_ROOT\WOW6432Node\AppID\{CECDDD22-2E72-4832-9606-A9B0E5E344B2}'
Remove-RegistryKey 'HKEY_CLASSES_ROOT\AppID\{CECDDD22-2E72-4832-9606-A9B0E5E344B2}'
Remove-RegistryKey 'HKEY_CLASSES_ROOT\WOW6432Node\AppID\{A6B716CB-028B-404D-B72C-50E153DD68DA}'
Remove-RegistryKey 'HKEY_CLASSES_ROOT\AppID\{A6B716CB-028B-404D-B72C-50E153DD68DA}'

# 防火墙规则
$fwRule = '{2D4EF01E-E2D0-4309-93F0-3CD7CED70748}'
try {
    Remove-NetFirewallRule -Name $fwRule -ErrorAction SilentlyContinue
    Write-Log "  [OK] 已删除防火墙规则: $fwRule"
} catch {
    cmd.exe /c "netsh advfirewall firewall delete rule name=`"$fwRule`"" 2>$null | Out-Null
    Write-Log "  [OK] 已删除防火墙规则(netsh): $fwRule"
}

# ---------------------------------------------------------------
# 3. SetupMetrics 遥测模块
# ---------------------------------------------------------------
Write-Log ""
Write-Log "[3/7] 移除 SetupMetrics 遥测模块..."

Remove-ItemForce "$EdgeWebViewRoot\Application\SetupMetrics"

# ---------------------------------------------------------------
# 4. Identity Proxy 全部
# ---------------------------------------------------------------
Write-Log ""
Write-Log "[4/7] 移除 Identity Proxy 全部..."

foreach ($vDir in $versionDirs) {
    Write-Log "  处理版本目录: $vDir"
    Remove-ItemForce "$vDir\identity_proxy"
    Remove-ItemForce "$vDir\ResiliencyLinks\identity_proxy"
}

# ---------------------------------------------------------------
# 5. uc_connector.exe
# ---------------------------------------------------------------
Write-Log ""
Write-Log "[5/7] 移除 uc_connector.exe..."

foreach ($vDir in $versionDirs) {
    Remove-ItemForce "$vDir\uc_connector.exe"
}

# ---------------------------------------------------------------
# 6. WNS 推送通知客户端
# ---------------------------------------------------------------
Write-Log ""
Write-Log "[6/7] 移除 WNS 推送通知客户端..."

foreach ($vDir in $versionDirs) {
    Remove-ItemForce "$vDir\wns_push_client.dll"
    Remove-ItemForce "$vDir\ResiliencyLinks\wns_push_client.dll.DATA"
}

# ---------------------------------------------------------------
# 7. WDAG 沙箱支持
# ---------------------------------------------------------------
Write-Log ""
Write-Log "[7/7] 移除 WDAG 沙箱支持..."

foreach ($vDir in $versionDirs) {
    Remove-ItemForce "$vDir\wdag.dll"
    Remove-ItemForce "$vDir\ResiliencyLinks\wdag.dll.DATA"
}

# =====================================================================
Write-Log ""
Write-Log "============================================================"
Write-Log "移除完成。日志文件: $logFile"
Write-Log "============================================================"

安全机制

  • 自动版本探测 :不硬编码版本号,自动发现 EdgeWebView\Application\<version>EdgeCore\<version> 目录
  • 提权删除 :首次失败后自动执行 takeown + icacls 授予 Administrators 完全控制权后重试
  • 注册表双通道 :PowerShell Provider 失败后回退到 reg.exe 命令
  • 完整日志:所有操作带时间戳记录,OK / SKIP / FAIL 三级状态
  • 幂等安全:重复运行不会报错,已删除项标记为 SKIP

实测结果

在 Windows 11 + WebView2 148.0.3967.70 环境下实测:

yaml 复制代码
步骤1/7 Copilot:        300 OK
步骤2/7 EdgeUpdate:      10 OK
步骤3/7 SetupMetrics:     1 OK
步骤4/7 Identity Proxy:   3 OK
步骤5/7 uc_connector:     2 OK
步骤6/7 WNS:              2 OK
步骤7/7 WDAG:             2 OK
──────────────────────────────
合计:                   320 OK / 0 FAIL / ~105 SKIP

SKIP 项均为正常情况:EdgeUpdate 的 Interface 注册表项随服务删除已级联清除;ResiliencyLinks 下的 .DATA 副本已在先前监控报告中对应的清理中删除。

使用方法

前提:必须以管理员权限运行。建议运行前创建系统还原点。

powershell 复制代码
# 以管理员身份打开 PowerShell
Set-ExecutionPolicy Bypass -Scope Process
.\Remove-WebView2Bloatware.ps1

脚本执行完成后,会在同目录生成 Remove-Bloatware_<时间戳>.log 日志文件。

WebView2 运行时验证

移除后可通过以下方式验证 WebView2 核心运行时完好:

powershell 复制代码
# 检查 WebView2 运行时注册表
Get-ItemProperty 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-429a-8B44-8E282C4B5B5E}'

# 检查核心 DLL 存在
Test-Path "${env:ProgramFiles(x86)}\Microsoft\EdgeWebView\Application\*\msedge.dll"

如需更完整的验证,可运行微软官方的 WebView2 Runtime 检测页面

许可证

MIT License --- 自由使用、修改和分发。

致谢

本脚本基于对 WebView2 安装过程的完整文件系统监控分析,监控报告记录了 1,755 行变更日志,涵盖 1,249 个文件删除和 200+ 个注册表项操作。每一条移除规则都经过人工判定,确保不触碰 WebView2 核心运行时组件。

相关推荐
一直会游泳的小猫4 小时前
Bun CLI:一键通吃的 JavaScript 终极武器
开源·包管理·开箱即用·javascriptcore·一个命令运行一切
该昵称用户已存在4 小时前
拒绝封闭技术栈绑架:MyEMS 开源能源管理平台的架构中立性与兼容性设计
架构·开源
效能革命笔记7 小时前
2026年开源组件治理选型:Gitee SCA如何成为一体化解决方案的推荐之选
gitee·开源
Soari8 小时前
告别商业收费与审核枷锁:深度拆解 Open-Generative-AI,构建 MIT 开源、零过滤的私有化视频生成工作站
人工智能·开源·音视频·私有化部署·sora·ai视频生成·generative-ai
Soari8 小时前
挑战 100ms 延迟极限:深度拆解 dograh,构建企业级开源 WebRTC 实时语音智能体平台
开源·大模型·webrtc·实时音视频·voiceagent·语音智能体·dograh
梦梦代码精9 小时前
深度拆解:上门按摩系统如何成为本地生活“到家时代”的新引擎?
docker·小程序·uni-app·开源·生活·开源软件
爱上纯净的蓝天9 小时前
新手友好型开源项目推荐:开启你的开源之旅
开源
魔乐社区10 小时前
小参数・大码力・易部署 | Qwen3.6-27B上线魔乐社区,基于昇腾的部署教程来了
人工智能·开源·大模型
Languorous.11 小时前
Linux 系统简介——开源世界的基石
linux·运维·开源