十一、部署一键重置功能:
1、准备 Scanstate 工具:
md U:\ScanState_amd64
copy "D:\WADK10\Assessment and Deployment Kit\User State Migration Tool\amd64" U:\ScanState_amd64
copy "D:\WADK10\Assessment and Deployment Kit\Windows Setup\amd64\Sources" U:\ScanState_amd64 /y
2、自定义 Windows RE 启动映像:(可选)
3、使用【Windows 映像和配置设计器】创建预配包。(可选)
4、使用【Windows 系统映像管理器】创建应答文件。(可选)
5、创建一键重置扩展脚本 ResetConfig.xml。(可选)
6、创建裸机恢复配置 ResetConfig.xml。(可选)
7、创建 Diskpart 脚本 CreatePartitions.txt 进行初始部署。
select disk 0
clean
convert gpt
rem == 1. Windows RE tools partition ============
create partition primary size=300
format quick fs=ntfs label="Windows RE tools"
assign letter="T"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
rem == 2. System partition ======================
create partition efi size=100
rem ** NOTE: For Advanced Format 4Kn drives,
rem change this value to size = 260 **
format quick fs=fat32 label="System"
assign letter="S"
rem == 3. Microsoft Reserved (MSR) partition ====
create partition msr size=128
rem == 4. Windows partition =====================
create partition primary size=102400
format quick fs=ntfs label="Windows"
assign letter="W"
rem == 5. Data partition ========================
create partition primary
shrink minimum=15000
format quick fs=ntfs label="Data"
assign letter="X"
rem == 6. Recovery image partition ==============
create partition primary
format quick fs=ntfs label="Recovery image"
assign letter="R"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
rem == 7. List Volume ===========================
list volume
exit
8、创建 Diskpart 脚本 ResetPartitions.txt 进行裸机恢复。(可选)
convert gpt
rem == 1. Windows RE tools partition ============
create partition primary size=300
format quick fs=ntfs label="Windows RE tools"
assign letter="T"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
rem == 2. System partition ======================
create partition efi size=100
rem ** NOTE: For Advanced Format 4Kn drives,
rem change this value to size = 260 **
format quick fs=fat32 label="System"
assign letter="S"
rem == 3. Microsoft Reserved (MSR) partition ====
create partition msr size=128
rem == 4. Windows partition =====================
create partition primary size=102400
format quick fs=ntfs label="Windows"
assign letter="W"
rem == 5. Data partition ========================
create partition primary
shrink minimum=15000
format quick fs=ntfs label="Data"
assign letter="X"
rem == 6. Recovery image partition ==============
create partition primary
format quick fs=ntfs label="Recovery image"
assign letter="R"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
rem == 7. List Volume ===========================
list volume
exit
9、使用 WinPE 启动目标计算机,使用以下命令创建硬盘分区:
Diskpart /s N:\CreatePartitions.txt
10、应用 Windows 安装映像:
Dism /Apply-Image /ImageFile:N:\Install.wim /Index:1 /ApplyDir:W:\
11、配置系统分区:
bcdboot W:\Windows /s S: /f UEFI
12、复制 WinRE 启动映像:
md T:\Recovery\WindowsRE
xcopy /h W:\Windows\System32\Recovery\Winre.wim T:\Recovery\WindowsRE\
13、注册 WinRE 启动映像:
W:\Windows\System32\Reagentc /Setreimage /Path T:\Recovery\WindowsRE /Target W:\Windows
14、重启目标计算机。
15、自定义捕获到设置包:
U:\ScanState_amd64\scanstate.exe /apps /ppkg C:\Recovery\Customizations\apps.ppkg /o /c /v:13 /l:C:\ScanState.log
16、恢复 WICD 预配包:(可选)
xcopy N:\RecoveryPPKG\*.ppkg C:\Recovery\Customizations
17、复制一键重置配置文件和扩展脚本:
mkdir C:\Recovery\OEM
xcopy /E N:\RecoveryScripts\* C:\Recovery\OEM
18、设置 C:\Recovery 文件夹权限:
icacls C:\Recovery\Customizations /inheritance:r /T
icacls C:\Recovery\Customizations /grant:r SYSTEM:(F) /T
icacls C:\Recovery\Customizations / grant:r *S-1-5-32-544:(F) /T
icacls C:\Recovery\OEM /inheritance:r /T
icacls C:\Recovery\OEM /grant:r SYSTEM:(F) /T
icacls C:\Recovery\OEM / grant:r *S-1-5-32-544:(F) /T
attrib +H C:\Recovery
19、重新封装 Windows 映像:
Sysprep /oobe /exit
20、关闭计算机,并重新捕获 Windows 映像。