联想一键恢复研究包含了OKR7.0 OKR8.1 OKR9.0 基础理论OKR7.0OKR8.1OKR9.0基础理论: 自定义BOOTMGR快捷键和添加硬件恢复按钮以启动Windows RE BIOS(MBR)格式的就是BOOTMGR快捷键 总结一下:通过BOOTMGR我们就可以 UEFI(GPT)格式就是HardwareRecovery Button(硬件按钮) 借鉴微软官网: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/jj631607(v=win.10)?redirectedfrom=MSDN MBR: 按照上面的理论就可以说明联想的NOVO按钮,DELL的F12 supportassist os recovery ,华硕的F9 ASUS Recovery,等等OEM机器都有自己的硬件按钮,我们不需要研究他们硬件按钮的值,因为通过微软官网描述,OEM只需要特定文件夹来定位并占用第一个硬件按钮 所以我们在返回 nttwqz的帖子,他是添加了第一第二按钮,如果我们是在带有硬件按钮的机器上,我们就不能使用第一个占位了,我们需要从第二个按钮开始添加, 例子: bcdedit /store {%BCD%} /set {bootmgr} customactions 0x10000400000010x54000002 0x1000041000001 0x54000003 bcdedit /store {%BCD%} /set {bootmgr} custom:54000002 {7619dcc9-fafe-11d9-b411-000476eba25f} bcdedit /store {%BCD%} /set {bootmgr} custom:54000003 {7619dcc9-fafe-11d9-b411-000476eba25f} (这里我添加了F6和F7作为示例) F1 F2 F3 F4 F5F6 F7 F8 F9 F10
方向键:↑↓←→
Home End PgUp PgDn Delete Insert 我们只需要剔除机器的特定快捷键,例如Lenovo和DELL都是F2和F12进入BIOS和菜单,F8 F10已经被系统占用 如果是老机器需要安装硬件模块,新机器应该不需要 如何分辨新老机器,老机器按下还原按钮直接进入恢复,新机器按下后需要选择system recovery 硬件按钮介绍完了,下面介绍一下winre 在mbr时期,也有winre只不过联想没有加入tools,其他品牌都加入了,通过自定义硬件按钮也可以进入winre.而联想只有novo按键. 到了win10后期引入了微软的还原方法和一部分的novo一键还原 所以说MBR和GPT都同样支持winre和硬件还原 但是!!!! 之前不是说了可以通过自定义按键来进入恢复环境吗,但是!!!GPT+UEFI(特别是UEFI的硬件还原都集成到了bios(system recovery)) 原因: MBRà BOOTMGR(可自定义按键winload.exe)->达到用户自定义按键来进入恢复环境 GPT->UEFI(不可自定义winload.efi)->所以很多品牌都有代替方案(winre)(dell 华硕等)
总结:MBR格式支持自定义按键进入恢复环境,GPT格式用winre代替方案进入恢复环境 接下来OKR7外,OKR8,9都支持MBR和GPT 所以OKR8,9,我会讲解两种部署方案 效果: MBR:联想电脑可通过NOVO按键或者 自定义按键 或者Winre菜单(MBR格式我没有加入winre,想要加的可以参考OKR9UEFI的教程添加winre)进入一键恢复 非联想电脑只能通过自定义按键进入一键恢复 GPT:联想电脑可通过NOVO按键或者Winre菜单进入一键恢复 非联想电脑只能通过Winre菜单进入一键恢复 OKR7.0@echo off set workdir=%~dp0 diskpart /s %workdir%\OKR701.ini //安装模块(不太清楚,应该是OKR中的模块分区(杀毒.硬件按钮.(老机器需要安装)) %workdir%\HDTOOL.EXE /CLR %workdir%\HDTOOL.EXE /0201 20m /0606 20m %workdir%\hsetup.exe /main %workdir%\dm.rom %workdir%\hsetup.exe /0606%workdir%\jet2vm.rom //分区 diskpart /s %workdir%\OKR702.ini //安装恢复分区 dism /Apply-Image /ImageFile:%workdir%\LENOVO_PART.okr /Index:1 /ApplyDir:Q:\ //安装系统(要在当前目录放一个系统wim文件~) dism /Apply-Image/ImageFile:%workdir%\install.wim /Index:1 /ApplyDir:T:\ //创建引导 bcdboot T:\Windows /s S: //硬件按钮 bcdedit /store S:\Boot\BCD /create{7619dcc8-fafe-11d9-b411-000476eba25f} /d "Device Options" /device bcdedit /store S:\Boot\BCD /set{7619dcc8-fafe-11d9-b411-000476eba25f} ramdisksdidevice partition=Q: bcdedit /store S:\Boot\BCD /set{7619dcc8-fafe-11d9-b411-000476eba25f} ramdisksdipath \boot\boot.sdi bcdedit /store S:\Boot\BCD /create{7619dcc9-fafe-11d9-b411-000476eba25f} /d "Windows Setup"/application osloader bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} deviceramdisk=[Q:]\OneKey\PE\lrs.wim,{7619dcc8-fafe-11d9-b411-000476eba25f} bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} path \windows\system32\boot\winload.exe bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} locale en-US bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} osdeviceramdisk=[Q:]\OneKey\PE\lrs.wim,{7619dcc8-fafe-11d9-b411-000476eba25f} bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} systemroot \windows bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} detecthal Yes bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} winpe Yes bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} vga No bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} quietboot Yes bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} ems Yes //这里按照自己的实际按键来修改,我这里是F6和F7(不止可以添加两个哦) bcdedit /store S:\Boot\BCD /set {bootmgr} displaybootmenu No bcdedit /store S:\Boot\BCD /set {bootmgr} customactions 0x1000040000001 0x54000002 0x1000041000001 0x54000003 bcdedit /store S:\Boot\BCD /set {bootmgr} custom:54000002 {7619dcc9-fafe-11d9-b411-000476eba25f} bcdedit /store S:\Boot\BCD /set {bootmgr} custom:54000003 {7619dcc9-fafe-11d9-b411-000476eba25f} //winre 开启修复 copy %workdir%\fix.cmd T:\Windows\System32 reg load hklm\backupT:\Windows\System32\config\software reg addHKLM\backup\Microsoft\Windows\CurrentVersion\RunOnce /v fix /t reg_sz /d"c:\windows\system32\fix.cmd" /f reg unload hklm\backup //备份系统 Dism /Capture-Image /CaptureDir:T:\/ImageFile:Q:\OKRBackup\Factory\OS.okr /Name:"Windows7_OS PBR Image" Dism /Capture-Image /CaptureDir:S:\/ImageFile:Q:\OKRBackup\Factory\Boot.okr /Name:" " //设置隐藏分区 diskpart /s%workdir%\tools\ini\SYDT70_Attrib.ini echo 完成 pause 我用了一个批处理来执行全部操作 OKR8和OKR9的部署(以OKR9为例,8和9是一样的,其中只有Winre恢复不一样,不过不影响,这里就不赘述了) 这里一样老机器需要安装模块,新机器不必,这里就没有演示安装模块!!!!! 这里就分mbr和gpt的两种了 //OKR9_MBR @echo off set workdir=%~dp0 //分区 diskpart /s %workdir%\OKR9_BIOS.ini //安装恢复分区 dism /Apply-Image/ImageFile:%workdir%\LENOVO_PART.okr /Index:1 /ApplyDir:Q:\ //安装系统 dism /Apply-Image/ImageFile:%workdir%\install.wim /Index:1 /ApplyDir:T:\ //设置引导 bcdboot T:\Windows /s S: //设置硬件按钮 bcdedit /store S:\Boot\BCD /create{7619dcc8-fafe-11d9-b411-000476eba25f} /d "Device Options" /device bcdedit /store S:\Boot\BCD /set{7619dcc8-fafe-11d9-b411-000476eba25f} ramdisksdidevice partition=Q: bcdedit /store S:\Boot\BCD /set{7619dcc8-fafe-11d9-b411-000476eba25f} ramdisksdipath \boot\boot.sdi bcdedit /store S:\Boot\BCD /create{7619dcc9-fafe-11d9-b411-000476eba25f} /d "Windows Setup"/application osloader bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} device ramdisk=[Q:]\onekey\winpe\lrs.wim,{7619dcc8-fafe-11d9-b411-000476eba25f} bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} path \windows\system32\boot\winload.exe bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} locale en-US bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} osdeviceramdisk=[Q:]\onekey\winpe\lrs.wim,{7619dcc8-fafe-11d9-b411-000476eba25f} bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} systemroot \windows bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} detecthal Yes bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} winpe Yes bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} vga No bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} quietboot Yes bcdedit /store S:\Boot\BCD /set{7619dcc9-fafe-11d9-b411-000476eba25f} ems Yes bcdedit /store S:\Boot\BCD /set {bootmgr} displaybootmenu No bcdedit /store S:\Boot\BCD /set {bootmgr} customactions 0x1000040000001 0x54000002 0x1000041000001 0x54000003 bcdedit /store S:\Boot\BCD /set {bootmgr} custom:54000002 {7619dcc9-fafe-11d9-b411-000476eba25f} bcdedit /store S:\Boot\BCD /set {bootmgr} custom:54000003 {7619dcc9-fafe-11d9-b411-000476eba25f} /*(注意:这里只支持OKR7和OKR8,OKR9的只能自己进入恢复环境备份了) OKR8的备份机制和OKR7差不多 Dism /Capture-Image /CaptureDir:T:\/ImageFile:Q:\OKRBackup\Factory\OS.okr /Name:"*****" 其中****可替换为: Windows7_OS PBR Image Windows8_OS PBR Image Windows10_OS PBR Image */ //设置隐藏分区 diskpart /s %workdir%\OKR9_attrib.ini pause 这里因为没研究OKR9的备份机制就没添加备份命令了,可以部署好后进入一键恢复进行备份 //OKR9 GPT @echo off set workdir=%~dp0 diskpart /s %workdir%\OKR9.ini //安装LRS_ESP dism /Apply-Image/ImageFile:%workdir%\OKR9_UEFI.Okr /Index:1 /ApplyDir:P:\ //安装WINRE_DRV dism /Apply-Image/ImageFile:%workdir%\OKR9_UEFI.Okr /Index:2 /ApplyDir:W:\ //安装LENOVO_PART dism /Apply-Image/ImageFile:%workdir%\OKR9_UEFI.Okr /Index:3 /ApplyDir:Q:\ //安装系统 dism /Apply-Image/ImageFile:%workdir%\install.wim /Index:1 /ApplyDir:T:\ //设置引导 T:\Windows\System32\bcdboot T:\Windows /sS: //关联winre T:\Windows\System32\Reagentc /Setreimage/Path W:\Recovery\WindowsRE /Target T:\Windows //添加winre菜单 T:\Windows\System32\Reagentc/setbootshelllink /configfile %workdir%\BootMenu.xml /Target T:\Windows //开启winre start /wait %workdir%\GUID.exe //设置lenovo分区 diskpart /s %workdir%\OKR9UEFI_attrib.ini pause 所需工具:链接:https://pan.baidu.com/s/1idJCMbsug8MKVesm2tu8VQ 提取码:1122
|