# win-scripts **Repository Path**: iogogogo/win-scripts ## Basic Information - **Project Name**: win-scripts - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-02 - **Last Updated**: 2026-08-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 实用脚本集合 ## 1. VMware 残留清理 删除旧版 VMware (17.x) 残留,让新版(26H1)安装器走「Install」而非「Upgrade」, 避免 `EULAS_AGREED` 许可协议错误和"Cleaning up legacy virtual network drivers"卡死。 ### 脚本说明 | 脚本 | 定位 | 推荐 | |---|---|---| | `VMware/clean-vmware-phase1.ps1` | 表层清理:服务、基础注册表、文件夹、System32 驱动、虚拟网卡、快捷方式 | — | | `VMware/clean-vmware-phase2.ps1` | 中层清理:MSI 数据库(Win32_Product/UpgradeCodes/Components)、驱动包(pnputil) | — | | `VMware/clean-vmware-phase3.ps1` | 精准打击:特定 GUID 搜索、C:\ProgramData 残留、虚拟设备强制卸载 | — | | **`VMware/clean-vmware-final.ps1`** | **三轮合并去重,一键到位** | **用这个** | Phase 1~3 是逐步排查的产物,正常情况直接跑 final 版即可。 ### 使用方法 管理员 PowerShell 中执行: ```powershell Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force & ".\VMware\clean-vmware-final.ps1" ``` ### 清理范围 | 类别 | 内容 | |---|---| | 服务 | vmci / vmnet / vmx86 / vmx-svcs / VMUSBArbService / VMAuthdService / hcmon 等 14 项 | | 注册表 | SOFTWARE\VMware 全部项、Uninstall 列表、MSI UserData Products / UpgradeCodes / Components / Features / Patches | | 文件夹 | Program Files\VMware、ProgramData\VMware、AppData\VMware | | 驱动 | System32/SysWOW64 中 vm*.sys/dll/exe、pnputil 驱动包 | | 设备 | VMware 虚拟网卡、PnP 设备 | | 快捷方式 | 开始菜单 / 桌面 | ### 执行后 - 最终验证全部 [OK] 后**不需要重启**,直接运行 VMware 26H1 安装程序 - 安装器应显示 **"Install"** 而非 "Upgrade" --- ## 2. 电源超时设置 (ThinkPad 增强版) `set-power-timeout.ps1` — 彻底解决 Windows 设置界面修改关屏/睡眠时间不生效的问题。 **根因**:Windows AC(接电源)和 DC(电池)是两套独立参数,GUI 改了 AC 不等于 DC 跟着走。 此外锁屏关屏(VIDEOCONLOCK)、屏保、自适应亮度、Intel 核显驱动都会独立覆盖关屏时间。 ### 使用方法 ```powershell Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force # 关屏 5 分钟,睡眠 5 分钟(同时设置 AC + DC) .\set-power-timeout.ps1 5 5 # 只设置 AC(接电源) .\set-power-timeout.ps1 5 5 -ACOnly # 只设置 DC(电池) .\set-power-timeout.ps1 5 5 -DCOnly # 关屏 10 分钟,睡眠 30 分钟 .\set-power-timeout.ps1 10 30 ``` ### 覆盖的 8 层超时源头 | # | 设置项 | GUID / 来源 | |---|---|---| | 1 | 关屏超时 (VIDEOIDLE) | AC + DC | | 2 | 睡眠超时 (STANDBYIDLE) | AC + DC | | 3 | 锁屏关屏超时 (VIDEOCONLOCK) | 默认仅 30 秒 | | 4 | 屏幕变暗超时 (VIDEODIM) | DC 默认 ~3.75 分钟 | | 5 | 屏幕保护程序 | 注册表 HKCU | | 6 | 自适应亮度 (ADAPTBRIGHT) | 系统电源子组 | | 7 | **ThinkPad 人体存在检测** | **EllipticHPDService (IR 摄像头误关屏)** | | 8 | Intel 核显电源计划 | 独立于 Windows 的硬件策略 | ### 适用设备 - ThinkPad T14 Gen4 (Intel Iris Xe) — 已实测 - 其他 ThinkPad / Intel 核显笔记本