实验室1d:将网络和其他预配包设置添加到映像Lab 1d: Add networking and other provisioning package settings to an image

使用预配包可以对现有 Windows IoT 核心安装映像应用自定义设置。A provisioning package allows you to apply customization settings over an existing Windows IoT Core installation image. 我们将介绍创建预配包所需的步骤,你可以将其应用于 Windows 10 IoT Core FFU 映像。We will describe the steps required to create a provisioning package that you can apply to your Windows 10 IoT Core FFU images.


若要测试 WiFi,你的主板将需要 WiFi 支持。To test WiFi, your board will need WiFi support. 可以使用 WiFi 适配器/转换器或类似于 Raspberry Pi 3 的板,其中包含 Wi-fi 内置版。You can use a WiFi adapter/dongle or a board like the Raspberry Pi 3 that has Wi-Fi built-in.

对于此实验,我们将使用 ProductB,其中包括默认应用(Bertha),该应用显示网络状态。For this lab, we'll use the ProductB, that includes the default app (Bertha), which shows network status.


请确保已创建了一个映像,其中包含自定义应用,以便之前将应用添加到映像Make sure you've created an image with your custom app from Add an app to an image previously.

需要安装以下工具才能完成此部分:You will need the following tools installed to complete this section:

  • Windows 评估和部署工具包 (Windows ADK)Windows Assessment and Deployment Kit (Windows ADK)
  • Windows 配置设计器Windows Configuration Designer
  • IoT 核心 PowerShell 环境IoT Core PowerShell Environment
  • 文本编辑器(如记事本或 VS CodeA text editor like Notepad or VS Code

安装 Windows 配置设计器Install Windows Configuration Designer

我们将使用Windows 配置设计器(WCD) 为 IoT 核心映像创建预配包。We will be using Windows Configuration Designer (WCD) to create a provisioning package for our IoT Core image. 使用 windows 配置设计器可以创建用于配置运行 Windows 10 IoT Core 的设备的预配包。Windows Configuration Designer allows you to create provisioning packages, which are used to configure devices running Windows 10 IoT Core.

Windows 配置设计器附带WINDOWS ADK 工具包,并且应已安装到技术人员电脑上。Windows Configuration Designer comes with the Windows ADK Toolkit and should have been installed to the Technician PC previously. 如果没有,请运行 Windows ADK 工具包的安装,并确保已选中 "安装"配置设计器If not, please run the install for the Windows ADK Toolkit and make sure you have the Configuration Designer selection checked for installation.

Windows ADK 中的配置设计器

为预配包创建 WCD 项目Create WCD Project for a Provisioning Package

若要为设备创建预配包,需要在Windows 配置设计器中创建一个项目。In order to create a provisioning package for your device, we need to create a project in Windows Configuration Designer. 完成此项目后,可以指定我们要包含在 FFU 映像中的配置自定义。Once we have this project, we can specify the configuration customizations we want included in our FFU image.

  1. 从 IoT Core imaging PC (技术人员电脑)运行Windows 映像和配置设计器From your IoT Core imaging PC (technician PC), run Windows Imaging and configuration Designer.

  2. 单击 "文件" > "新建项目",创建一个新项目。Create a new project by clicking File > New Project. 在我们的示例中,我们创建了一个名为_TestProvPackage_的项目。For our example, we created a project called TestProvPackage.

  3. 选择 "设置包" 并单击 "下一步"。Select Provisioning Package and click Next.

  4. 在 "选择要查看和配置的设置" 页上,选择 " Windows 10 IoT Core"。On the Choose which settings to view and configure page, select Windows 10 IoT Core. 单击?下一步?。Click Next.


  1. 在 "导入预配包(可选) " 页上,将条目留空,然后单击 "完成"。At the Import a provisioning package (optional) page, leave the entry blank and click Finish.

  2. 添加示例设置:Add a sample setting:

a.a. 展开 "运行时设置" > 连接配置文件 > WLAN > WLANSetting > SSIDExpand Runtime settings > Connectivity Profiles > WLAN > WLANSetting > SSID.

b.b. 键入 Wi-fi 网络名称(例如 ContosoWiFi)的名称,然后单击 "添加"。Type in the name of a Wi-Fi network name, for example, ContosoWiFi, and click Add.

c.c. 展开SSID > WLANXmlSettings > "SecurityType ",然后选择 "打开" 等设置。Expand the SSID > WLANXmlSettings > SecurityType and choose a setting such as Open.

d.d. 展开SSID > WLANXmlSettings > AutoConnect ,然后选择一个设置,例如TRUEExpand the SSID > WLANXmlSettings > AutoConnect and choose a setting such as TRUE.

e.e. 可选:若要添加多个 WLAN 网络,请返回到 WLANSetting,并重复该过程。Optional: To add more than one WLAN network, go back to WLANSetting, and repeat the process.

  1. 可选:通过 UI 添加其他应用、驱动程序和设置。Optional: Add other apps, drivers, and settings through the UI. 若要了解详细信息,请参阅使用 WINDOWS ICD 配置自定义To learn more, see Configure customizations using Windows ICD.

  2. 导出预配包。Export the provisioning package. 例如,单击 "导出" > 预配包 > 下一步 > (取消选中 "加密包" 框) > 接下来的 > 生成For example, click Export > Provisioning Package > Next > (Uncheck the Encrypt Package box) > Next > Build. (若要了解详细信息,请参阅导出预配包。)(To learn more, see Export a provisioning package.)


对预配包进行任何更改时,Windows 配置设计器会在预配文件(自定义 .xml)中递增版本号。When you make any changes to a provisioning package, Windows Configuration Designer increments the version number in the provisioning file (customizations.xml). Windows 10 版本 1709开始,预配包的版本号也是一个四部分编号,与常规打包版本相同。Starting with Windows 10 release 1709, the version number for provisioning package is also a four part number, same as the regular packaging version. 在以前的版本中(在版本1709之前),版本号不是主要版本号。次要版本号,是带小数点的数字。In previous releases (prior to release 1709), the version number is not major.minor, it is a number with a decimal point. 例如,1.19 的版本低于1.2。For example, 1.19 is a lower version than 1.2.


作为替代方法,你可以使用任何所需的更改(包括上述 wifi 设置)更新 C:\MyWorkspace\Source-<arch>\Products\ProductB\prov 中的自定义项。As an alternative, you can update customizations.xml in the C:\MyWorkspace\Source-<arch>\Products\ProductB\prov with any desired changes, including the above wifi settings. 在这种情况下,不需要新包。In such case, you will not need a new package. 如果进行了更改,请确保递增版本号。Make sure you increment the version number if you make changes. 有关详细信息,请参阅Windows 预配答案文件See Windows provisioning answer file for more information.

  1. 从工作区打开IoTCorePShell文件并执行以下 powershell 命令。Open IoTCorePShell.cmd file from your workspace and execute the following powershell commands.
Add-IoTProvisioningPackage Prov.WiFiSettings "C:\IoT\Provisioning\WiFiSettings\WiFiSettings.ppkg"
(or) newprovpkg Prov.WiFiSettings "C:\IoT\Provisioning\WiFiSettings\WiFiSettings.ppkg"

这会在 C:\MyWorkspace\Common\Packages\Prov.WifiSettings创建一个新文件夹。This creates a new folder at C:\MyWorkspace\Common\Packages\Prov.WifiSettings.

这还会将 FeatureID PROV_WIFISETTINGS添加到 C:\MyWorkspace\Common\Packages\OEMCOMMONFM.xml 文件中。This also adds a FeatureID PROV_WIFISETTINGS to the C:\MyWorkspace\Common\Packages\OEMCOMMONFM.xml file.

  1. 构建用于预配的 cab 文件。Build a cab file for provisioning.

    New-IoTCabPackage Prov.WifiSettings
    (or) buildpkg Prov.WifiSettings

更新项目的配置文件Update the project's configuration files

  1. 使用IoTProductFeature更新产品测试配置文件Update the product test configuration file using Add-IoTProductFeature

    Add-IoTProductFeature ProductB Test PROV_WIFISETTINGS -OEM
    (or) addfid ProductB Test PROV_WIFISETTINGS -OEM

生成和测试映像Build and Test Image

重新生成 FFU 映像,如创建基本映像中所指定。Build the FFU image again, as specified in Create a basic image. 只需运行IoTFFUImage命令:You should only have to run the New-IoTFFUImage command:

New-IoTFFUImage ProductX Test
(or)buildimage ProductX Test 

构建 FFU 文件并根据Flash Windows IoT Core 映像中指定的方式将其闪存给硬件设备后,应在打开设备电源时应用预配包自定义。Once the FFU file has been built and you flash it to your hardware device as specified in Flash a Windows IoT Core Image, your provisioning package customizations should be applied when you power up the device. 在我们的示例中,默认应用是IoT Core 默认应用,它会在设备启动时显示有关映像的基本信息。In our example, the default app is the IoT Core Default app, which will show basic info about the image when the device is booted up.

测试以查看是否已应用预配设置Test to see if your provisioning settings were applied

  1. 拔下 IoT 设备的所有网络电缆。Unplug any network cables from your IoT device.

  2. 选择默认值。Select the defaults. 在 "获取连接" 屏幕上,选择 "跳过此步骤"。At the Let's get connected screen, select Skip this step.

  3. 如果无线网络位于范围内,则此屏幕应显示已成功连接的网络,并显示网络的 IP 地址。If your wireless network is in range, this screen should show the network successfully connected, and show an IP address for the network.

测试网络连接和上传应用Test network connections and upload apps

可以连接到设备的门户页,对网络连接进行故障排除、上载应用或查看有关设备的更多详细信息。You can connect to your device's portal page to troubleshoot network connections, upload apps, or see more details about your device.

  1. 将技术人员电脑和设备连接到同一网络。Connect both your technician PC and the device to the same network.

    例如,若要通过有线网络进行连接,请插入以太网电缆。For example, to connect over a wired network, plug in a ethernet cable. 若要通过无线连接,请确保技术人员计算机和 IoT 核心设备都已连接到同一无线网络。To connect over wireless, make sure both your technician computer and IoT Core device are connected to the same wireless network.

  2. 在技术人员计算机上,打开 Internet Explorer,并使用 http://前缀和:8080后缀键入设备的 IP 地址。On your technician PC, open Internet Explorer, and type in the device's IP address with an http:// prefix and :8080 suffix.
  3. 出现提示时,输入设备的默认用户名和密码。When prompted, enter your device's default username and password. (默认值为: Administrator \ p@ssw0rd)(Default is: Administrator \ p@ssw0rd)

    这会打开Windows 设备门户This opens the Windows Device Portal. 在此处,你可以上传应用程序包,查看安装的应用,以及在它们之间进行切换。From here, you can upload app packages, see what apps are installed, and switch between them.

  4. 单击 "网络 > 配置文件"。Click Networking > Profiles. 应会看到已创建的 Wi-fi 配置文件。You should see the Wi-Fi profile you created.

    如果设备能够自动连接到 WiFi 网络,则在 "可用网络" 下,你应看到配置的网络旁边的复选标记。If the device is able to automatically connect to the WiFi network, then under Available Networks, you should see a checkmark next to the network you configured.

    如果你的网络需要接受许可条款等步骤,则设备可能不会自动连接。If your network requires steps such as accepting license terms, the device may not auto-connect.


检查 wi-fi 广播频率(2.4 ghz Vs 5ghz)Check your Wi-Fi broadcast frequency (2.4GHz vs 5GHz). 某些 Wi-fi 适配器(如 Raspberry Pi 3 上的内置 Wi-fi 适配器)仅支持 2.4 GHz Wi-fi 网络。Some Wi-Fi adapters, such as the built-in Wi-Fi adapter on the Raspberry Pi 3, only support 2.4GHz Wi-Fi networks. 虽然这是最常见的 Wi-fi 广播频率,但许多 Wi-fi 网络以5GHz 的频率进行广播。While this is the most common Wi-Fi broadcast frequency, many Wi-Fi networks broadcast at frequencies of 5GHz. 更改广播频率或使用其他适配器。Either change the broadcast frequency or use a different adapter.

确认预配包设置在您的网络上工作Confirm that the provisioning package settings work on your network. 使用便携式计算机测试:Use a laptop PC to test:

  1. 断开笔记本电脑与网络的连接:单击系统任务栏中的网络图标,选择无线网络,然后单击 "断开连接"。Disconnect the laptop from the network: Click on the network icon in the system tray, select the wireless network, and click Disconnect.

  2. 确认网络不再处于连接状态。Confirm that the network is no longer connected.

  3. 双击 ProductAProv 安装预配包。 ppkg。Install the provisioning package by double-clicking ProductAProv.ppkg. 无线网络应该会自动连接。The wireless network should connect automatically.

检查配置文件是否已添加到设备Check to see if the profile has been added to the device

  1. 使用连接到设备的以太网连接。Connect using an ethernet connection to the device.

  2. 使用 SSH 客户端(如PuTTY)进行连接。Connect using an SSH client, such as PuTTY.

  3. 连接后,请检查已安装的配置文件:When connected, check to see what profiles have been installed:

    netsh wlan show profiles

    网络应该出现在用户配置文件列表中。The network should appear in the list of User profiles.

为每个设备使用不同的设备名称。Use a different device name for each device. 这可以帮助防止网络冲突。This can help prevent network conflicts. 为设备创建媒体时设置此名称。Set this name while creating media for the device.

后续步骤Next steps

Lab 1e:向映像添加驱动程序Lab 1e: Add a driver to an image