feat: PLANNING体系首版(00路线图/02任务总表/03执行协议/I-03/I-04/registry42口径)+M1止血交付
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# ============================================================
|
||||
# 修复 Windows Hypervisor 未加载(Docker Desktop 依赖)
|
||||
# 必须以管理员身份运行(UAC 弹窗后自动提权)
|
||||
# 动作:
|
||||
# 1. bcdedit 开启 hypervisorlaunchtype auto
|
||||
# 2. 备份原 BCD 到 C:\bcd-backup
|
||||
# 3. 输出修复日志到 C:\hypervisor_fix_log.txt
|
||||
# 4. 提示用户重启(不自动重启)
|
||||
# ============================================================
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$log = 'C:\hypervisor_fix_log.txt'
|
||||
"=== Hypervisor Fix $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') ===" | Out-File $log -Encoding utf8
|
||||
|
||||
function Log($m) {
|
||||
$m | Tee-Object -FilePath $log -Append
|
||||
}
|
||||
|
||||
# 必须管理员
|
||||
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
if (-not $isAdmin) {
|
||||
Log "ERROR: not running as admin - relaunching elevated..."
|
||||
Start-Process pwsh -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
|
||||
exit
|
||||
}
|
||||
|
||||
# 1. 备份 BCD
|
||||
Log "[1/3] Backing up BCD to C:\bcd-backup ..."
|
||||
bcdedit /export C:\bcd-backup 2>&1 | Out-Null
|
||||
if (Test-Path C:\bcd-backup) { Log " backup OK" } else { Log " backup FAILED (continuing)" }
|
||||
|
||||
# 2. 读取当前状态
|
||||
Log "[2/3] Current hypervisorlaunchtype:"
|
||||
$current = bcdedit /enum '{current}' 2>&1 | Select-String 'hypervisorlaunchtype'
|
||||
if ($current) { Log (" " + $current.ToString().Trim()) } else { Log " (not present -> defaults to OFF on some installs)" }
|
||||
|
||||
# 3. 设置 auto
|
||||
Log "[3/3] Setting hypervisorlaunchtype auto ..."
|
||||
$out = bcdedit /set '{current}' hypervisorlaunchtype auto 2>&1
|
||||
Log (" " + ($out -join ' '))
|
||||
|
||||
# 验证
|
||||
$after = bcdedit /enum '{current}' 2>&1 | Select-String 'hypervisorlaunchtype'
|
||||
if ($after -match 'auto') {
|
||||
Log "SUCCESS: hypervisorlaunchtype is now Auto"
|
||||
Log ""
|
||||
Log ">>> 请重启电脑使 Hypervisor 生效 <<<"
|
||||
} else {
|
||||
Log "VERIFY FAILED: $after"
|
||||
}
|
||||
|
||||
Log ""
|
||||
Log "Press Enter to close..."
|
||||
Read-Host | Out-Null
|
||||
Reference in New Issue
Block a user