使用 CopyProfile 自定义默认用户配置文件Customize the default user profile by using CopyProfile

Windows 使用默认用户配置文件作为模板,将配置文件分配给每个新用户。Windows uses the default user profile as a template to assign a profile to each new user. 通过自定义默认用户配置文件,可以配置在计算机上创建的所有用户帐户的设置。By customizing the default user profile, you can configure settings for all user accounts that are created on the computer.

可以使用 CopyProfile 设置来自定义用户配置文件,然后将该配置文件复制到默认用户配置文件。You can use the CopyProfile setting to customize a user profile and then copy that profile to the default user profile. 使用 CopyProfile 即可自定义已安装的应用程序、驱动程序、桌面背景、Internet Explorer 设置以及其他配置。By using CopyProfile, you can customize installed applications, drivers, desktop backgrounds, Internet Explorer settings, and other configurations. 请注意,使用 CopyProfile 无法保留某些设置。Be aware that some settings are not preserved by using CopyProfile.

备注

不能使用 CopyProfile 自定义“开始”菜单。Using CopyProfile to customize the Start menu isn't supported. 在 Windows 10 中,可以改用以下方法管理自定义的“开始”菜单布局:Instead, you can use the following methods to manage custom Start layouts in Windows 10:

某些用户配置文件设置(包括“默认应用”)使用特定于用户的哈希进行加密。Some user profile settings, including Default Apps, are encrypted by using a hash that is specific to the user. 如果将这些设置复制到另一个用户配置文件,则 Windows 会将其视为无效设置,并会在用户首次登录时将其重置。If you copy these settings to another user profile, Windows treats them as invalid and resets them the first time that the user signs in. Windows 不支持使用 CopyProfile 来复制这些设置。Windows does not support using CopyProfile to copy these settings.

重要

如果注册表修改不正确,可能会发生严重问题。Serious problems might occur if you modify the registry incorrectly. 在修改注册表之前,请备份注册表,以便在出现问题时可以还原。Before you modify it, back up the registry for restoration in case problems occur.

运行 CopyProfile 后,必须删除来自默认用户的一些注册表项,以防止重置问题。After you run CopyProfile, you must delete some registry entries from the default user to prevent reset issues. 可按如下方式继续操作:Here’s how to procced:

  1. 打开注册表编辑器Open Registry Editor.

  2. 找到并选择此子树:Locate and select this subtree:
    HKEY_USERSHKEY_USERS

  3. 在“文件”菜单上,选择“加载 Hive” 。On the File menu, select Load Hive.

    备注

    默认情况下,不存在默认用户 Hive。The default user hive isn’t present by default. 必须手动加载、编辑,再卸载它。It must be loaded, edited, and then unloaded manually.

  4. 在“文件名”框中键入 C:\Users\Default\NTUSER.DAT,然后选择“打开” 。Type C:\Users\Default\NTUSER.DAT in the File name box and select Open.

  5. 在“加载 Hive”对话框的“键名称”框中键入临时名称 <DefaultUser>,然后按 Enter。In the Load Hive dialog box, type a temporary name <DefaultUser> in the Key Name box and press Enter.

  6. 删除这些注册表项:Delete these registry entries:

    • HKEY_USERS\<DefaultUser>\Software\Microsoft\Windows\Shell\Associations\FileAssociationsUpdateVersion
    • HKEY_USERS\<DefaultUser>\Software\Microsoft\Windows\Shell\Associations\UrlAssociations
    • HKEY_USERS\<DefaultUser>\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts

    备注

    这些注册表项仅在运行 CopyProfile 后存在。These registry entries are present only after running CopyProfile.

  7. 转到 HKEY_USERS\<DefaultUser>Go to HKEY_USERS\<DefaultUser>.

  8. 在“文件”菜单上,选择“卸载 Hive” 。On the File menu, select UnLoad Hive.

  9. 关闭 注册表编辑器Close Registry Editor.

现在,当用户首次登录 Windows 时,Windows 会从 oemdefaultassociations.xml 文件加载常用的“默认应用程序”设置。Now Windows will load the usual Default Applications settings from the oemdefaultassociations.xml file when a user signs in to Windows for the first time.

创建包含 CopyProfile 设置的答案文件Create an answer file that includes the CopyProfile setting

Windows SIM 中创建一个答案文件,该文件将 amd64_Microsoft-Windows-Shell-Setup_neutral\ 添加到“第 4 阶段 - 专用化”,并将 CopyProfile 设置为 TrueIn Windows SIM, create an answer file that has amd64_Microsoft-Windows-Shell-Setup_neutral\ added to Pass 4 - Specialize, and set CopyProfile to True. 将该答案文件另存为 copyprofile.xmlSave this answer file as copyprofile.xml. 我们将在运行 Sysprep 时使用此答案文件。You'll use this answer file when you run Sysprep.

有关详细信息,请参阅有关如何创作答案文件的最佳做法无人参与 Windows 安装程序参考For more information, see Best Practices for Authoring Answer Files and Unattended Windows Setup Reference.

配置默认用户配置文件设置Configure the default user profile settings

在审核模式下配置用户设置,然后使用已将 CopyProfile 设置为 True 的答案文件来通用化 Windows 安装。Configure user settings in audit mode, and then generalize the Windows installation by using an answer file that has CopyProfile set to True. 如果使用另一个答案文件来安装 Windows,请确保答案文件没有 CopyProfile 或任何用于创建其他用户帐户的设置。If you install Windows by using another answer file, make sure that answer file doesn't have CopyProfile or any settings that create additional user accounts.

  1. 在参考计算机上安装 Windows,然后在审核模式下启动该计算机。Install Windows on a reference computer and start the computer in audit mode. 有关详细信息,请参阅将 Windows 启动到审核模式或 OOBEFor more information, see Boot Windows to Audit Mode or OOBE.

    重要

    不要使用域帐户来启动计算机。Don't use a domain account to start the computer. 这是因为,当你运行 Sysprep 时,CopyProfile 设置会在计算机从域中删除之后运行。This is because the CopyProfile setting runs after the computer is removed from the domain when you run Sysprep. 因此,你会丢失在域中配置的任何设置。Therefore, you'll lose any settings that you configured in a domain. 如果更改默认用户配置文件,然后将计算机加入域,则对默认用户配置文件所做的自定义会显示在新的域帐户上。If you change the default user profile and then join the computer to a domain, the customizations that you made to the default user profile appear on new domain accounts.

  2. 通过安装应用程序、桌面快捷方式和其他设置自定义内置的管理员帐户。Customize the built-in administrator account by installing applications, desktop shortcuts, and other settings.

    重要

    可以安装的、基于 Windows 运行时的已预配应用的数目有限。The number of provisioned Windows runtime-based apps that you can install is limited. 但是,可以创建脚本来安装其他未预配的应用。However, you can create scripts to install additional non-provisioned apps. 有关详细信息,请参阅使用 DISM 旁加载应用For more information, see Sideload Apps with DISM.

  3. 完成自定义后,将包含 CopyProfile 答案文件的媒体插入参考计算机。After you complete the customizations, insert the media that contains the CopyProfile answer file in the reference computer. 例如,可以将答案文件复制到 USB 驱动器。For example, you can copy the answer file to a USB drive.

  4. 在参考计算机中,打开提升的命令提示符窗口,然后键入以下命令:On the reference computer, open an elevated command prompt, and then type this command:

    C:\Windows\System32\Sysprep\Sysprep /generalize /oobe /shutdown /unattend:F:\CopyProfile.xml
    

    在此命令中,F 是 U 盘或其他可移动媒体的驱动器号。In this command, F is the letter of the USB flash drive or other removable media. Sysprep 工具从映像中删除特定于计算机的信息,同时保留已配置的用户配置文件设置。The Sysprep tool removes computer-specific information from the image, while it preserves the user profile settings that you configured. 有关详细信息,请参阅 Sysprep(通用化)Windows 安装For more information, see Sysprep (Generalize) a Windows installation.

通用化映像并关闭计算机后,捕获映像。After you generalize the image and the computer shuts down, capture the image. 为此,请在 Windows PE 环境中启动计算机。To do this, start the computer in the Windows PE environment. 使用 DISM 捕获并部署 Windows 安装。Use DISM to capture and then deploy the Windows installation. 有关详细信息,请参阅创建可启动 WinPE 介质使用单个 .WIM 文件捕获并应用 Windows 映像For more information, see Create bootable WinPE media and Capture and apply a Windows image using a single .WIM file.

测试用户配置文件自定义Test the user profile customizations

将自定义映像部署到目标计算机后,可以使用该计算机测试用户配置文件自定义。After you deploy the customized image to a destination computer, you can use that computer to test the user profile customizations. 可以通过全新安装体验 (OOBE) 来测试用户体验,也可以在审核模式下测试用户自定义。You can go through Out-Of-Box Experience (OOBE) to test the user experience, or you can test the user customizations in audit mode.

重要

基于 Windows 运行时的应用不会在审核模式下启动,因为审核模式使用内置的管理员帐户。Apps that are based on the Windows runtime won't start in audit mode because audit mode uses the built-in administrator account. 若要在审核模式下运行基于 Windows 运行时的应用,必须修改注册表项。To run Windows runtime-based apps in audit mode, you must modify a registry entry.

在 OOBE 之后测试用户配置文件自定义To test the user profile customizations after OOBE

  1. 将 Windows 安装到测试计算机。Install Windows to a test computer.

  2. Windows 安装好以后,请完成 OOBE 并指定计算机名称、用户帐户名和其他项。After Windows installs, go through OOBE and specify the computer name, user account name, and other items. 完成 OOBE 后,会显示 Windows 开始屏幕。After you complete OOBE, the Windows start screen appears.

  3. 使用在 OOBE 期间指定的用户帐户登录到计算机,并验证是否显示了应用和自定义。Sign in to the computer by using the user account that was specified during OOBE, and verify that your apps and customizations appear.

在审核模式下测试用户配置文件自定义To test the user profile customizations in audit mode

  1. 使用答案文件或在 OOBE 启动时按 Ctrl+Shift+F3,以审核模式启动计算机。Start the computer in audit mode by using an answer file or by pressing Ctrl+Shift+F3 when OOBE starts. 有关详细信息,请参阅将 Windows 启动到审核模式或 OOBEFor more information, see Boot Windows to Audit Mode or OOBE.

  2. 验证自定义是否按预期工作。Verify that your customizations work as intended. 若要测试基于 Windows 运行时的应用,请修改注册表,如下所示:To test Windows Runtime-based apps, modify the registry as follows:

    1. 在提升的命令提示符下运行 Regedit.exe。From an elevated command prompt, run Regedit.exe.

    2. 浏览到以下注册表项:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\FilterAdministratorTokenBrowse to the following registry entry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\FilterAdministratorToken

    3. 选择“FilterAdministrationToken”,然后键入 1 作为值数据。Select FilterAdministrationToken, and then type 1 as the value data.

    4. 从计算机注销。Sign off from the computer.

    5. 重新登录到计算机,然后启动基于 Windows 运行时的应用,验证自定义是否按预期工作。Sign back on to the computer, and start the Windows runtime-based apps to verify that your customizations work as intended.

    6. 验证基于 Windows 运行时的应用后,将 FilterAdministrationToken 注册表项重置为 0After you validate your Windows runtime-based apps, reset the FilterAdministrationToken registry entry to 0.

排查 CopyProfile 问题Troubleshooting CopyProfile

如果未成功复制用户配置文件设置,请执行以下步骤:If the user profile settings aren't successfully copied, follow these steps:

  1. 确保在部署过程中只设置一次 CopyProfile 设置。Make sure that you set the CopyProfile setting only one time during the deployment process.

  2. 自定义用户设置时,只在计算机上使用内置管理员帐户,避免意外复制错误配置文件中的设置。When you customize user settings, use only the built-in administrator account on the computer to avoid accidentally copying settings from the wrong profile.

  3. 验证是否使用了域帐户。Verify that you didn't use a domain account.

  4. 验证除了已配置的内置管理员帐户,是否有其他用户帐户。Verify that there are no additional user accounts other than the built-in administrator account that you configured. 要实现这一点,请执行下列操作:To do this, follow these steps:

    1. 选择“开始”,然后键入“控制面板”。Select Start, and then type Control Panel.

    2. 选择“控制面板” > “添加或删除用户帐户”。 Select Control Panel > Add or remove user accounts.

    3. 选择已配置的内置管理员帐户外的其他用户帐户,然后删除该帐户。Select any additional user account other than the built-in administrator account that you configured, and then delete that account.

      备注

      请先删除计算机上的所有其他用户帐户,然后再自定义内置管理员帐户。Delete all other user accounts on the computer before you customize the built-in administrator account.

  5. 若要在基于 Windows 运行时的非预配应用(在用户登录后注册)的“开始”屏幕上保留磁贴布局,请确保在用户登录后两小时内安装这些应用。To preserve the tile layout on the Start screen for non-provisioned Windows runtime-based apps that register after the user signs in, make sure that the apps install within two hours of the user signing in.

  6. 某些设置只能通过 CopyProfile 无人参与 设置来配置,另外一些设置可以使用组策略来配置。Some settings can be configured only by using the CopyProfile unattend setting, and other settings can be configured by using Group Policy. 为此,请使用下列任一方法:To do this, use either of the following methods:

    • 使用组策略配置通过新用户登录过程重置的设置。Use Group Policy to configure settings that are reset by the new user signin process. 还可创建脚本来定义这些用户设置。You can also create scripts to define these user settings.

    • 使用 CopyProfile 无人参与 设置。Use the CopyProfile unattend setting. 有关详细信息,请参阅无人参与 Windows 安装参考For more information, see Unattended Windows Setup Reference.

相关主题Related topics

Sysprep(系统准备)概述Sysprep (System Preparation) Overview

Sysprep 过程概述Sysprep Process Overview

Sysprep 命令行选项Sysprep Command-Line Options