Windows7硬盘恢复方案的设计与实现一、目标参照LenovoOEM模式,实现Windows7从硬盘上隐藏分区中恢复到出厂状态,用户可通过高级恢复方式或在启动时按F8修复计算机触发实现。二、主要步骤利用WindowsAIK或WindowsOPK构建Windows7应答文件和进行OEM定制;在参考计算机上安装Windows7,然后创建安装映像和恢复映像创建批处理文件,在目标计算机上应用映像,并执行sysprep命令实现Windows7首次体验在目标计算机上,两种方式下测试硬盘恢复方案三、前提条件一台技术人员计算机(Windows7系统,安装WindowsAIK、UltraISO9.3,配置刻录机)一台参考计算机一台目标计算机Windows7AIKDVDWindows7产品DVD(采用网络下载MSDNWindows7UltimateX86ISO映像)BenQ80G移动硬盘一只OEM定制文件夹及图片信息(从网络获取,以Lenovo为样本)刻录机/空白CD/DVD技术人员计算机的主要操作安装Windows7OPK制作WindowsPE的DVD和移动硬盘启动媒介创建分布式共享,添加OEM定制信息到分布式共享中构建三个应答文件(AutoUnattend.xml、OOBE.xml、Sysprepunattend.xml)制作WindowsPE启动光盘步骤1:设置WindowsPE构建环境单击“开始”,依次指向“所有程序”、WindowsOPK或WindowsAIK,右键单击“部署工具命令提示符”,然后选择“以管理员身份运行”。定位到C:\ProgramFiles\x86\Tools中在命令提示符下运行Copype.cmd脚本copype.cmdx86c:\winpe_x86将winpe.wim复制到\Winpe_x86\ISO\sources文件夹,并将该文件重命名为Boot.wim。copyc:\winpe_x86\winpe.wimc:\winpe_x86\ISO\sources\boot.wim步骤2:添加Imagex.exe到WindowsPE中(两种方式添加:一种启动后即在当前目录下,另一种在另一个盘符中,推荐第一种,修改boot.wim)copyC:\programfiles\version\Tools\x86\imagex.exeC:\winpe_x86\iso\步骤3:使用Oscdimg创建.iso文件。在命令提示符下,键入:oscdimg-n-bC:\winpe_x86\etfsboot.comC:\winpe_x86\ISOC:\winpe_x86\winpe_x86.iso步骤4:将映像刻录到CD-ROM或DVD-ROM上在移动硬盘上创建可启动的WindowsPERAM磁盘步骤一和步骤二:同制作WindowsPE启动光盘步骤三:准备UFD在技术人员计算机上,插入移动硬盘。在管理员命令提示符下,使用Diskpart将移动硬盘格式化为跨越整个磁盘的NTFS,然后将此分区设置为活动状态。diskpartselectdisk1cleancreatepartitionprimaryselectpartition1activeformatquickfs=ntfsassignexit步骤四:将步骤二完成后\ISO目录中的所有内容复制到移动硬盘中,可手动拷贝或执行命令:xcopyc:\winpe_x86\iso\*.*/ef:\制作三个应答文件。以Ultimate版本为例,启动WindowsOPK,对Windows7Ultimate.cfg进行操作。第一,制作AutoUnattend.xml应答文件添加和配置Windows设置ComponentConfigurationPassMicrosoft-Windows-Deployment\ResealoobeSystemMicrosoft-Windows-International-Core-WinPEwindowsPEMicrosoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartitionwindowsPEMicrosoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartitionwindowsPEMicrosoft-Windows-Setup\ImageInstall\OSImage\InstallTowindowsPEMicrosoft-Windows-Setup\UserDatawindowsPE组件的属性值设置ComponentValueMicrosoft-Windows-International-Core-WinPEInputLocale=zh-CNSystemLocale=zh-CNUILanguage=zh-CNUserLocale=zh-CNMicrosoft-Windows-International-Core-WinPE\SetupUILanguageUILanguage=zh-CNMicrosoft-Windows-SetupUseConfigurationSet=TrueMicrosoft-Windows-Setup\DiskConfigurationWillShowUI=OnErrorMicrosoft-Windows-Setup\DiskConfiguration\DiskDiskID=0WillWipeDisk=trueMicrosoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartitionExtend=trueOrder=1Type=PrimaryMicrosoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartitionActive=trueFormat=NTFSLabel=WIN7_OSLetter=COrder=1PartitionID=1Microsoft-Windows-Setup\ImageInstall\OSImage\WillShowUI=OnErrorMicrosoft-Windows-Setup\ImageInstall\OSImage\InstallToDiskID=0PartitionID=1Microsoft-Windows-Setup\UserDataAcceptEula=trueMicrosoft-Windows-Setup\UserData\ProductKeyKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXXWillShowUI=OnErrorMicrosoft-Windows-Deployment\ResealForceShutdownNow=falseMode=Audit第二,添加OEM配置信息添加和配置Windows设置ComponentConfigurationPassMicrosoft-Windows-Deployment\RunSynchronous\RunSynchronousCommandauditUserMicrosoft-Windows-Deployment\RunSynchronous\RunSynchronousCommandauditUserMicrosoft-Windows-IE-InternetExplorer\FavoritesList\FavoriteItemSpecializeMicrosoft-Windows-IE-InternetExplorer\StartPages\StartPageSpecializeMicrosoft-Windows-IE-InternetExplorer\StartPages\StartPageSpecializeMicrosoft-Windows-PerfCenterCPL\WindowsExperienceIndexOemInfooobeSystemMicrosoft-Windows-Shell-Setup\OEMInformationSpecialize组件属性值设置ComponentValueMicrosoft-Windows-IE-InternetExplorer\FavoritesList\FavoriteItemFavID=Favorite1FavTitle=LenovoFavURL==Homepage1StartPageURL==Homepage2StartPageURL==falseLogo=c:\Windows\System32\OOBE\Info\Lenovo.bmpManufacturer=ChinaLenovoGroupSupportHours=EveryDayfrom7:00to19:00SupportPhone=0512-66668888SupportURL===c:\Windows\System32\OOBE\Info\Lenovo.png第三,利用记事本程序制作OOBE.XML文件,内容如下:?xmlversion=1.0encoding=utf-8?FirstExperienceoobeoemnameLenovo/namelogopathc:\Windows\System32\OOBE\Info\Lenovo.png/logopathOutOfBoxBackgroundtrue/OutOfBoxBackgroundusertilepathc:\Windows\System32\OOBE\Info\usertile.bmp/usertilepath/oem/oobe/FirstExperience第四,制作命令行下执行Sysprep所需的Sysprepunattend.xml添加和配置Windows设置ComponentConfigurationPassMicrosoft-Windows-Shell-Setup_neutralSpecializeMicrosoft-Windows-International-Core_neutraloobeSystemMicrosoft-Windows-Shell-Setup_neutraloobeSystemMicrosoft-Windows-Shell-Setup_neutral\OOBEoobeSystemMicrosoft-Windows-Shell-Setup_neutral\UserAccounts\LocalAccountsoobeSystemMicrosoft-Windows-Shell-Setup_neutral\UserAccounts\LocalAccounts\PasswordoobeSystem组件的属性值设置