自动化 Windows 安装Automate Windows Setup

您可以阻止在安装期间显示 Windows 安装程序中 (UI) 页面的部分或全部用户界面。You can prevent some or all of the user interface (UI) pages from Windows Setup from being displayed during installation. Windows 安装程序的默认行为是在任何所需的设置不正确或为空时显示安装 UI。The default behavior of Windows Setup is to display the Setup UI if any of the required settings are incorrect or empty.

安装 Windows 时使用应答文件Use an answer file while installing Windows

可以使用应答文件自动执行 Windows 安装:You can automate Windows installation by using an answer file:

使用 USB 闪存驱动器Use a USB flash drive

  1. 使用现有答案文件或使用 Windows 系统映像管理器创建自己的 (WINDOWS SIM) Use an existing answer file or create your own with Windows System Image Manager (Windows SIM).

  2. 将该文件另存为 USB 闪存驱动器根目录中的 Autounattend.xmlSave the file as Autounattend.xml on the root of a USB flash drive.

  3. 在新电脑上,插入 Windows 安装 USB 闪存驱动器以及包含 Autounattend.xml 的闪存驱动器,然后启动电脑。On a new PC, insert a Windows installation USB flash drive, as well as the flash drive that contains Autounattend.xml and then boot the PC. 如果未选择其他答案文件,则 Windows 安装程序搜索此文件。When no other answer file is selected, Windows Setup searches for this file.

选择应答文件Select an answer file

设置列表List of settings

下面列出了这些答案文件中使用的设置:The following is a list of the settings used in these answer files:

  • Windows 安装程序语言设置: Microsoft-Windows- \ UILanguage -winpe SetupUILanguage UILanguage 和 microsoft-国际核心-winpe \ \ Windows Setup language settings: Microsoft-Windows-International-Core-WinPE\UILanguage and Microsoft-Windows-International-Core-WinPE\SetupUILanguage\UILanguage.

  • 产品密钥: \ \ ProductKey \ 密钥Product key: Microsoft-Windows-Setup\UserData\ProductKey\Key.

自动 Windows 安装程序Automating Windows Setup

若要自动执行 Windows 安装程序,请将以下每个 Windows 安装程序页面的设置添加到无人参与的安装答案文件。To automate Windows Setup, add settings for each of the following Windows Setup pages to your unattended Setup answer file. 配置 Windows 安装程序页面的设置时,Windows 安装程序会跳过该页面。When a setting for a Windows Setup page is configured, Windows Setup skips that page.

语言、区域和输入法选择页面Language, Region, and Input Method Selection Page

设置Setting 描述Description

Microsoft-Windows-azure-WinPE | UILanguageMicrosoft-Windows-International-Core-WinPE | UILanguage

指定要在已安装的 Windows 操作系统上使用的默认语言。Specifies the default language to use on the installed Windows operating system.

Microsoft-Windows-azure-WinPE |SetupUILanguage | UILanguageMicrosoft-Windows-International-Core-WinPE | SetupUILanguage | UILanguage

指定 Windows 安装程序期间使用的默认语言。Specifies the default language to use during Windows Setup. 在安装过程中,Windows 安装程序将以所选语言显示安装进度。During installation, Windows Setup displays installation progress in the selected language.

注意Note
使用 Windows 安装程序的 Autounattend.xml 文件并依赖于隐式答案文件搜索时,安装程序中的 "语言选择" 页将不会显示,即使您在答案文件中显式不配置语言设置也是如此。When you use an Autounattend.xml file with Windows Setup and rely on an implicit answer-file search, the language selection page in Setup is not displayed, even if you explicitly do not configure language settings in your answer file. 有关隐式答案文件的详细信息,请参阅 Windows 安装程序自动化概述For more information about implicit answer files, see Windows Setup Automation Overview.

键入用于激活的产品密钥页Type your Product Key for Activation Page

产品密钥必须与要安装的 Windows 版本相匹配。The product key must match the Windows edition you intend to install. 有关详细信息,请参阅 使用产品密钥和激活For more information, see Work with Product Keys and Activation.

设置Setting 描述Description

Microsoft-Windows-安装 |UserData |ProductKey | Microsoft-Windows-Setup | UserData | ProductKey | Key

指定用于安装 Windows 的产品密钥。Specifies the product key used to install Windows.

Microsoft-Windows-安装 |ImageInstall |OSImage |InstallFrom |元数据 | () 。Microsoft-Windows-Setup | ImageInstall | OSImage | InstallFrom | MetaData | (Key and Value).

将键和值一起使用,以选择要安装的特定 Windows 映像。Use Key and Value together to select a specific Windows image to install. 对于某些 Windows Server®2012版是必需的。Required for some Windows Server® 2012 editions.

可以使用 DISM/Get-ImageInfo 命令获取映像信息。You can get the image information by using the DISM /Get-ImageInfo command. 有关详细信息,请参阅 映像管理 Command-Line 选项For more information, see Image Management Command-Line Options.

接受 Microsoft 软件许可条款页Accept Microsoft Software License Terms Page

设置Setting 描述Description

Microsoft-Windows-安装 |UserData | AcceptEulaMicrosoft-Windows-Setup | UserData | AcceptEula

指定是否在 Windows 安装程序期间接受 Microsoft 许可软件条款。Specifies whether to accept Microsoft License Software Terms during Windows Setup.

选择 "升级" 或 "自定义安装" 页Select Upgrade or Custom Installation Page

默认情况下,当使用应答文件时,不会显示此页,并且会将 Windows 配置为新安装。By default, when an answer file is used, this page does not appear and Windows is configured as a new installation. 若要将 Windows 配置为升级,请添加以下设置:To configure Windows as an upgrade, add the following setting:

设置Setting 描述Description

Microsoft-Windows-安装 |UpgradeData | 升级Microsoft-Windows-Setup | UpgradeData | Upgrade

指定当前安装是从早期版本的 Windows 升级而来的。Specifies that the present installation is an upgrade from a previous version of Windows.

指定 Windows 页面的安装位置Specify Where to Install Windows Page

可以指定精确的磁盘 ID 和分区 ID,也可以将 Windows 安装到第一个可用分区。You can either specify the exact disk ID and partition ID, or you can install Windows to the first available partition. 若要预配置分区,你可能还需要配置驱动器分区。To preconfigure your partitions, you may also need to configure your drive partitions. 有关完整的 XML 示例和推荐的分区配置,请参阅 如何配置基于 UEFI/GPT 的硬盘分区如何配置基于 BIOS/MBR 的硬盘分区For full XML examples and recommended partition configurations, see How to Configure UEFI/GPT-Based Hard Disk Partitions or How to Configure BIOS/MBR-Based Hard Disk Partitions.

设置Setting 描述Description

Microsoft-Windows-安装 |ImageInstall |OSImage |InstallTo | DiskIDMicrosoft-Windows-Setup | ImageInstall | OSImage | InstallTo | DiskID

指定将在其中安装 Windows 的磁盘。Specifies the disk where Windows will be installed.

Microsoft-Windows-安装 |ImageInstall |OSImage |InstallTo | PartitionIDMicrosoft-Windows-Setup | ImageInstall | OSImage | InstallTo | PartitionID

指定将在其中安装 Windows 的分区。Specifies the partition where Windows will be installed.

- 或 --or-

设置Setting 描述Description

Microsoft-Windows-安装 |ImageInstall |OSImage | InstallToAvailablePartitionMicrosoft-Windows-Setup | ImageInstall | OSImage | InstallToAvailablePartition

指定在第一个可用分区上安装 Windows。Specifies to install Windows on the first available partition.

用于无人参与 Windows 部署服务的设置Settings to Use with Unattended Windows Deployment Services

使用 Windows 部署服务部署 Windows 时,请将以下部分中的每个设置添加到无人参与安装答案文件。When deploying Windows using Windows Deployment Services, add each of the settings in the following sections to your unattended-Setup answer file. 这是无人参与安装所需的唯一设置。These are the only settings required for an unattended installation.

选择语言和区域设置页面Select a Language and Locale Page

设置Setting 描述Description

Microsoft-Windows-azure-WinPE |SetupUILanguage | UILanguageMicrosoft-Windows-International-Core-WinPE | SetupUILanguage | UILanguage

指定 Windows 安装程序期间使用的默认语言。Specifies the default language to use during Windows Setup.

提供 Windows 部署服务凭据 "页面Provide Windows Deployment Services Credentials Page

设置Setting 描述Description

Microsoft-Windows-安装 |WindowsDeploymentServices | 登录名Microsoft-Windows-Setup | WindowsDeploymentServices | Login

指定用于 Windows 部署服务登录的凭据,并指定用于登录的 UI 显示的情况。Specifies the credentials used for Windows Deployment Services logon, and specifies in what circumstances the UI is displayed for logon.

选择要安装的映像页Select an Image to Install Page

设置Setting 描述Description

Microsoft-Windows-安装 |WindowsDeploymentServices | ImageSelectionMicrosoft-Windows-Setup | WindowsDeploymentServices | ImageSelection

指定要安装的映像及其安装位置,以及是否显示 UI。Specifies the image to be installed and the location where it is installed, as well as whether the UI is displayed.

指定 Windows 页面的安装位置Specify Where to Install Windows Page

这些设置假设你要安装到已分区的磁盘驱动器。These settings assume that you are installing to a partitioned disk drive.

设置Setting 描述Description

Microsoft-Windows-安装 |WindowsDeploymentServices |ImageSelection |InstallTo | DiskIDMicrosoft-Windows-Setup | WindowsDeploymentServices | ImageSelection | InstallTo | DiskID

指定映像要安装到的磁盘的磁盘 ID。Specifies the disk ID of the disk to which the image is to be installed.

Microsoft-Windows-安装 |WindowsDeploymentServices |ImageSelection |InstallTo | PartitionIDMicrosoft-Windows-Setup | WindowsDeploymentServices | ImageSelection | InstallTo | PartitionID

指定映像要安装到的分区的分区 ID。Specifies the partition ID of the partition to which the image is to be installed.

相关主题Related topics

用于自动执行 OOBE 的设置Settings for Automating OOBE

Windows 安装程序技术参考Windows Setup Technical Reference