建立 Windows Server 2003 部署映像前,刪除分頁檔可減少複製時間與映像體積。本文說明使用 Sysprep 自動完成的兩種方法。注意:不可在網域控制站使用 Sysprep。
regedit,定位 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management。PagingFiles,值改為 C:\pagefile.sys 0 0。此設定會在關機時強制刪除分頁檔。目標電腦首次開機時,會依實體記憶體大小自動重建分頁檔。
PagingFiles 值為 C:\pagefile.sys 0 0。Zeropage.reg。Zeropage.reg 文字檔,內容如下:Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"PagingFiles"=hex(7):43,00,3a,00,5c,00,70,00,61,00,67,00,65,00,66,00,69,00,6c,\
00,65,00,2e,00,73,00,79,00,73,00,20,00,30,00,20,00,30,00,00,00,00,00
Sysprep.cmd 批次檔:regedit /s a:\zeropage.reg
a:\sysprep -noreboot -pnp
執行批次檔即可自動套用登錄並啟動 Sysprep (不重開機、偵測新硬體)。目標電腦部署後首次開機會依新硬體記憶體調整分頁檔大小。
方法一適合手動單機操作,方法二適合批次部署自動化。兩者核心皆為預先設定登錄強制刪除分頁檔,再由 Sysprep 完成一般化。