Windows Autopilot 用户驱动的Microsoft Entra加入步骤:
- 步骤 3:为 Windows Autopilot 配置文件创建 JSON 文件
- 步骤 4:在 Configuration Manager 中创建和分发 JSON 文件的包
- 步骤 5:在 Configuration Manager 中创建 Windows Autopilot 任务序列
- 步骤 6:在 Configuration Manager 中创建集合
- 步骤 7:在 Configuration Manager 中将 Windows Autopilot 任务序列部署到集合
- 步骤 8: (可选) 加快部署过程
- 步骤 9: 在设备上运行 Windows Autopilot 任务序列
- 步骤 10: 注册 Windows Autopilot 的设备
有关现有设备的 Windows Autopilot 部署工作流的概述,请参阅 Intune 中现有设备的 Windows Autopilot 部署和 Configuration Manager。
为 Windows Autopilot 配置文件创建 JSON 文件
注意
本部分中的 PowerShell 代码片段已于 2023 年 7 月更新为使用 Microsoft Graph PowerShell 模块,而不是已弃用的 AzureAD Graph PowerShell 模块。 首次使用 Microsoft Graph PowerShell 模块时,可能需要批准Microsoft Entra ID 中的其他权限。 有关详细信息,请参阅 AzureAD 和 重要提示:Azure AD Graph 停用和 PowerShell 模块弃用。
安装适当的模块以允许从 Intune 导出 Windows Autopilot 配置文件后,下一步是将 Windows Autopilot 配置文件导出为 JSON 文件。 JSON 文件用于在 Configuration Manager 中创建包。
若要将 Windows Autopilot 配置文件导出为 JSON 文件,请执行以下步骤:
登录到Configuration Manager站点服务器或其他设备,其中安装了所需模块,以从 Intune 获取 Windows Autopilot 配置文件。
在设备上,以管理员身份打开 PowerShell 窗口,方法是右键单击“开始”菜单并选择“Windows PowerShell (管理员) /Windows 终端 (管理员) 然后在”用户帐户控制“ (UAC) 提示符下选择”是”。
通过选择以下 PowerShell 代码块右上角的“复制”,复制以下命令:
Connect-MgGraph -Scopes "Device.ReadWrite.All", "DeviceManagementManagedDevices.ReadWrite.All", "DeviceManagementServiceConfig.ReadWrite.All", "Domain.ReadWrite.All", "Group.ReadWrite.All", "GroupMember.ReadWrite.All", "User.Read" $AutopilotProfile = Get-AutopilotProfile $targetDirectory = "C:\Autopilot" $AutopilotProfile | ForEach-Object { New-Item -ItemType Directory -Path "$targetDirectory\$($_.displayName)" $_ | ConvertTo-AutopilotConfigurationJSON | Set-Content -Encoding Ascii "$targetDirectory\$($_.displayName)\AutopilotConfigurationFile.json" }将命令粘贴到提升的 PowerShell 窗口中,然后在 键盘上选择 Enter 以运行命令。 如果提升的 PowerShell 命令窗口尚未登录到 Intune,则会显示“ 登录到帐户 ”窗口。 使用有权访问 Intune 和 Windows Autopilot 配置文件的 Microsoft Entra 帐户登录。
登录到 Intune 后,可能需要再次选择 Enter ,才能在代码块中运行最后一个命令。
所有命令成功运行后,Windows Autopilot 配置文件将显示在变量指定的
$targetDirectory文件夹下的子文件夹中。 默认情况下,变量$targetDirectory为C:\AutoPilot,但如果需要,可以将其更改为其他位置。 子文件夹具有 Intune 中 Windows Autopilot 配置文件的名称。 如果有多个 Windows Autopilot 配置文件,则每个配置文件都有自己的子文件夹。 每个文件夹中都有一个名为 的AutopilotConfigurationFile.jsonJSON 文件。
注意
上述脚本从 Intune 导出所有 Windows Autopilot 配置文件。 除了受支持的用户驱动 Windows Autopilot 配置文件外,它还下载不受支持的预预配 Windows Autopilot 配置文件和自部署 Windows Autopilot 配置文件(如果它们存在于环境中)。
下一步:在 Configuration Manager 中创建和分发 JSON 文件的包
相关内容
有关创建 JSON 文件的详细信息,请参阅以下文章: