Sysprep (一般化) Windows 安裝Sysprep (Generalize) a Windows installation

若要將 Windows 映像部署到不同的電腦,您必須先將映射一般化,以移除電腦特定的資訊,例如已安裝的驅動程式和電腦安全性識別碼 (SID) 。To deploy a Windows image to different PCs, you have to first generalize the image to remove computer-specific information such as installed drivers and the computer security identifier (SID). 您可以使用 sysprep 本身或 sysprep 搭配自動安裝 回應檔案,將您的映射一般化並讓它準備好進行部署。You can either use Sysprep by itself or Sysprep with an unattend answer file to generalize your image and make it ready for deployment.

一般化 Windows 安裝Generalize a Windows installation

當您將 Windows 映像一般化時,Windows 安裝程式會處理 一般化 設定階段中的設定。When you generalize a Windows image, Windows Setup processes settings in the generalize configuration pass. 即使您正在捕捉即將部署到具有類似硬體之電腦的映射,還是必須將 Windows 安裝一般化,以從 Windows 安裝中移除獨特的電腦專屬資訊,讓您安全地重複使用您的映射。Even if you're capturing an image that's going to be deployed to a PC with similar hardware, you still have to generalize the Windows installation to remove unique PC-specific information from a Windows installation, which allows you to safely reuse your image.

當您將映射一般化時,Windows 只會在您執行 Sysprep 的作業系統磁片區上取代電腦 SID。When you generalize an image, Windows replaces the computer SID only on the operating system volume where you ran Sysprep. 如果單一電腦有多個作業系統,您必須在每個映射上個別執行 SysprepIf a single computer has multiple operating systems, you must run Sysprep on each image individually.

如果您要將具有遠端驗證撥入消費者服務 (RADIUS) 用戶端或網路原則伺服器中定義的遠端 RADIUS 伺服器群組的 Windows Server 安裝, (NPS) 設定中,您應該先移除此資訊,再將其部署到其他電腦。If you're generalizing a Windows Server installation that has Remote Authentication Dial-In User Service (RADIUS) clients or remote RADIUS server groups defined in the Network Policy Server (NPS) configuration, you should remove this information before you deploy it to a different computer. 如需詳細資訊,請參閱 準備 (NPS) 的網路原則伺服器以進行映射處理For more information, see Prepare a Network Policy Server (NPS) for Imaging.

防止 Sysprep 移除已安裝的裝置Prevent Sysprep from removing installed devices

當您設定 Windows 電腦時,Windows 安裝程式會設定所有偵測到的裝置。When you set up a Windows PC, Windows Setup configures all detected devices. 將 Windows 安裝一般化會卸載設定的裝置,但不會從電腦移除設備磁碟機。Generalizing a Windows installation uninstalls configured devices, but does not remove device drivers from the PC.

如果您要將映射部署到與原始電腦具有相同硬體和裝置的電腦上,您可以使用自動安裝檔案搭配 Microsoft Windows-Microsoft-windows-pnpsysprep,在系統一般化期間將裝置安裝在電腦上。 PersistAllDeviceInstalls 設定為 trueIf you're deploying an image to computers that have identical hardware and devices as the original PC, you can keep devices installed on the computer during system generalization by using an unattend file with Microsoft-Windows-PnpSysprep | PersistAllDeviceInstalls set to true. 如需 Sysprep 相關 Windows 自動安裝元件的詳細資訊,請參閱 Microsoft microsoft-windows-pnpsysprep 的自動 Windows 安裝程式參考For more information about Sysprep-related Windows unattend components, see the Unattended Windows Setup Reference for Microsoft-Windows-PnpSysprep.

您可以執行 Sysprep 多少次的限制Limits on how many times you can run Sysprep

您可以在單一 Windows 映像上執行 Sysprep 命令最多1001次。You can run the Sysprep command up to 1001 times on a single Windows image. 執行 Sysprep 1001 次之後,您必須重新建立 Windows 映像。After running Sysprep 1001 times, you must recreate your Windows image. 請參閱下表:Refer the following table:

作業系統版本Operating System Version Sysprep 計數限制Sysprep Count Limit
Windows 10 (版本 1803)Windows 10, version 1803 10011001
Windows 10 (版本 1709)Windows 10, version 1709 10011001
Windows 10 (版本 1703)Windows 10, version 1703 10011001
Windows 10,版本1607和 Windows Server 2016Windows 10, version 1607 and Windows Server 2016 10011001
Windows 10 (版本 1511)Windows 10, version 1511 10011001
Windows 10 (版本 1507)Windows 10, version 1507 10011001
Windows 8.1 與 Windows Server 2012 R2Windows 8.1 and Windows Server 2012 R2 10011001
Windows Server 2012Windows Server 2012 10011001
Windows 7 與 Windows Server 2008 R2Windows 7 and Windows Server 2008 R2 33
Windows Server 2008Windows Server 2008 33

在舊版 Windows 中,您可以使用 [回應檔案] 設定,在執行 SkipRearm Sysprep 時重設 Windows 產品啟用時鐘。In previous versions of Windows, you could use the SkipRearm answer file setting to reset the Windows Product Activation clock when running Sysprep. 如果您使用大量授權金鑰或零售產品金鑰,則不需要使用, SkipRearm 因為 Windows 會自動啟用。If you are using a volume licensing key or a retail product key, you don't have to use SkipRearm because Windows is automatically activated.

Microsoft Store 應用程式Microsoft Store apps

在一般化 Windows 映像之前,安裝新的 Microsoft Store 應用程式或更新現有的 Microsoft Store 應用程式將會導致 Sysprep 失敗。Installing new Microsoft Store apps or updating your existing Microsoft Store apps before generalizing a Windows image will cause Sysprep to fail. Sysprep /generalize 需要為所有使用者布建所有的應用程式;不過,當您從 Microsoft Store 更新應用程式時,該應用程式會系結至已登入的使用者帳戶。Sysprep /generalize requires that all apps are provisioned for all users; however, when you update an app from the Microsoft Store, that app becomes tied to the logged in user account. Sysprep 記錄檔中出現下列錯誤 (位於% WINDIR% \ System32 \ Sysprep \ >\panther\setupact.log) :The following error appears in the Sysprep log files (located at %WINDIR%\System32\Sysprep\Panther):

<package name> was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.

除了使用 Microsoft Store 來更新您的應用程式,您應該側載企業營運應用程式的更新、為所有使用者布建離線授權的商務用 Microsoft Store 應用程式,或讓使用者使用其目的地電腦上的 Microsoft Store 來更新其應用程式。Instead of using the Microsoft Store to update your apps, you should sideload updates to your line-of-business apps, provision offline-licensed Microsoft Store for Business apps for all users, or have end-users update their apps by using the Microsoft Store on their destination PCs. 如果 IT 系統管理員已停用受管理環境中的 Microsoft Store 存取,終端使用者將無法更新 Microsoft Store 的應用程式。If Microsoft Store access in a managed environment is disabled by an IT administrator, end-users will not be able to update the Microsoft Store apps.

如需側載企業營運 Microsoft Store 應用程式的詳細資訊,請參閱 使用 DISM 側載應用程式自訂開始畫面For more information about sideloading line-of-business Microsoft Store apps, see Sideload Apps with DISM and Customize the Start Screen.

將映射一般化Generalize an image

從 Audit 模式一般化Generalize from Audit Mode

若要將映射一般化,您必須先開機進入 Audit 模式。To generalize an image, you have to first boot into Audit Mode. 您可以使用自動安裝檔案或從現成體驗 (OOBE) 畫面開機進入稽核模式。You can boot into Audit Mode using an unattend file or from the Out-Of-Box Experience (OOBE) screen. 您可以閱讀 開機 Windows 到 Audit 模式或 OOBE的不同方式,以瞭解如何啟動進入稽核模式。You can read about the different ways of booting into Audit Mode at Boot Windows to Audit Mode or OOBE.

  1. 將電腦開機進入稽核模式。Boot a PC into Audit Mode. 當 Windows 開機進入稽核模式時, 系統準備工具 將會出現在桌面上。When Windows boots into Audit Mode, System Preparation Tool will appear on the desktop. 您可以選擇關閉 [ 系統準備工具 ] 視窗,或讓它保持開啟狀態。You can choose to either close the System Preparation Tool window or allow it to remain open.

  2. 藉由新增驅動程式、變更設定和安裝程式來自訂 Windows。Customize Windows by adding drivers, changing settings, and installing programs. 請勿使用 Microsoft Store 安裝任何 Microsoft Store 應用程式。Do not install any Microsoft Store apps using the Microsoft Store.

  3. 執行 Sysprep。Run Sysprep.

    • 如果 [ 系統準備工具 ] 視窗仍處於開啟狀態,請按一下 [ 一般化],再按一下 [ 關機],然後按一下 [確定] 將映射一般化並關閉電腦。If the System Preparation Tool window is still open, click Generalize, click Shutdown, and then click OK to generalize the image and shut down the PC.

      -或--or-

    • 從命令提示字元使用 Sysprep。Use Sysprep from Command Prompt. 執行 %WINDIR%\system32\sysprep\sysprep.exe 以開啟 [ 系統準備] 視窗Run %WINDIR%\system32\sysprep\sysprep.exe to open the System Preparation Window. 您也可以使用 Sysprep 命令搭配 /generalize/shutdown/oobe 選項。You can also use the Sysprep command together with the /generalize, /shutdown, and /oobe options. 請參閱 Sysprep 命令列選項 以查看可用的選項。See Sysprep command-line options to see available options.

      %WINDIR%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe
      

      注意

      如果您要將在相同虛擬機器或虛擬程式上部署為 VHD 的 VHD 一般化,請使用此 /mode:vm 選項搭配 Sysprep 命令列。If you are generalizing a VHD that will be deployed as a VHD on the same virtual machine or hypervisor, use the /mode:vm option with the Sysprep command-line.

      電腦一般化映射並關機。The computer generalizes the image and shuts down.

  4. 電腦關機之後,請 使用 DISM 來捕捉您的映射After the computer shuts down, capture your image with DISM.

  5. 將此映射部署至參照電腦。Deploy this image to a reference computer. 當參照電腦開機時,它會顯示 OOBE 畫面。When the reference computer boots, it displays the OOBE screen.

使用自動安裝進行一般化Generalize using unattend

如果您在電腦部署期間使用多個自動安裝檔案,您可以將下列設定新增至您的每個自動安裝檔案,以便 Windows 安裝程式在處理自動安裝檔案後將電腦一般化。If you use multiple unattend files during your computer deployment, you can add the following settings to your each of your unattend files so Windows Setup will generalize the PC after processing the unattend file.

  • 若要自動將映射一般化並關機,請使用 Microsoft-Windows-部署 | Generalize 設定。To automatically generalize the image and shut down, use the Microsoft-Windows-Deployment | Generalize setting. 設定 ModeOOBEAudit,並設定 ForceShutdownNowtrueSet Mode to OOBE or Audit, and set ForceShutdownNow to true.

-或--or-

  • 若要將系統一般化並讓它開機進入 Audit 模式,請使用 Microsoft-Windows-部署 | Reseal 設定為 oobeSystem 設定階段。To generalize the system, and have it boot into Audit Mode, use the Microsoft-Windows-Deployment | Reseal setting to the oobeSystem configuration pass. 設定 ModeAuditSet Mode to Audit.

相關主題Related topics

Sysprep 程序概觀Sysprep Process Overview

Sysprep 命令列選項Sysprep Command-Line Options

伺服器角色的 Sysprep 支援Sysprep Support for Server Roles

使用產品金鑰和啟用Work with Product Keys and Activation