# ======================================================== # Edge 浏览器自动 IE 模式配置脚本(整个 WebManage 目录) # 目标路径: http://10.10.124.200/WebManage # 必须以管理员身份运行 # ======================================================== Write-Host "开始配置 Edge 浏览器 IE 模式..." -ForegroundColor Cyan # 1. 定义 XML 内容(匹配整个 WebManage 目录) $XmlContent = @" IE11 IE11 "@ # 2. 创建存放目录并生成 site-list.xml $XmlDir = "C:\IEList" $XmlFile = "$XmlDir\site-list.xml" if (!(Test-Path $XmlDir)) { New-Item -ItemType Directory -Path $XmlDir -Force | Out-Null Write-Host "已创建目录: $XmlDir" } # 确保写入的是无 BOM 的 UTF-8 格式(避免浏览器解析报错) [System.IO.File]::WriteAllText($XmlFile, $XmlContent, (New-Object System.Text.UTF8Encoding($false))) Write-Host "已生成站点列表文件: $XmlFile" -ForegroundColor Green # 3. 配置注册表策略 $RegPath = "HKLM:\SOFTWARE\Policies\Microsoft\Edge" if (!(Test-Path $RegPath)) { New-Item -Path $RegPath -Force | Out-Null } # 启用 IE 模式集成 (1 = 允许在 IE 模式下重新加载网站) New-ItemProperty -Path $RegPath -Name "InternetExplorerIntegrationLevel" -Value 1 -PropertyType DWORD -Force | Out-Null # 指定站点列表文件路径 New-ItemProperty -Path $RegPath -Name "InternetExplorerIntegrationSiteList" -Value $XmlFile -PropertyType String -Force | Out-Null Write-Host "已配置 Edge 注册表策略" -ForegroundColor Green # 4. 强制刷新组策略 Write-Host "正在刷新组策略..." gpupdate /force | Out-Null Write-Host "组策略刷新完成!" -ForegroundColor Green Write-Host "`n配置全部完成!" -ForegroundColor Yellow Write-Host "请【完全关闭并重新启动 Microsoft Edge 浏览器】(确保任务管理器中无 msedge 进程),然后访问 http://10.10.124.200/WebManage/Logon.aspx 验证。" -ForegroundColor Yellow Write-Host "验证方法:在 Edge 地址栏输入 edge://compat/enterprise 查看站点列表是否加载成功。"