Windows Autopilot 使用者驅動的 Microsoft Entra 連接步驟:
- 步驟 3:建立 Windows Autopilot 設定檔的 JSON 檔案
- 步驟 4:在 設定管理員 建立並分發 JSON 檔案的套件
- 步驟 5:在 設定管理員 建立 Windows Autopilot 任務序列
- 步驟 6:在 設定管理員 建立集合
- 步驟 7:將 Windows Autopilot 任務序列部署至 設定管理員 的集合
- 步驟八: 加速部署流程 (可選)
- 步驟 9: 在裝置上執行 Windows Autopilot 任務序列
- 步驟 10: 註冊 Windows Autopilot 裝置
欲了解現有裝置 Windows Autopilot 部署工作流程的概述,請參閱 Intune 與 設定管理員 中的 Windows Autopilot 部署。
為 Windows Autopilot 設定檔建立 JSON 檔案
注意事項
本節的 PowerShell 程式碼片段於 2023 年 7 月更新,改用 Microsoft Graph PowerShell 模組,取代已棄用的 AzureAD Graph PowerShell 模組。 Microsoft Graph PowerShell 模組在首次使用時可能需要在 Microsoft Entra ID 中獲得額外權限的核准。 欲了解更多資訊,請參閱 AzureAD 及重要事項:Azure AD Graph Retirement and PowerShell Module Deprecation。
安裝適當模組以支援從 Intune 匯出 Windows Autopilot 設定檔後,下一步是將 Windows Autopilot 設定檔匯出為 JSON 檔案。 JSON 檔案用於在 設定管理員 中建立套件。
要將 Windows Autopilot 設定檔匯出為 JSON 檔案,請遵循以下步驟:
登入安裝所需模組的 設定管理員 網站伺服器或其他裝置,從 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.json.
注意事項
上述腳本會從 Intune 匯出所有 Windows Autopilot 設定檔。 除了支援的使用者驅動 Windows Autopilot 設定檔外,它還會下載未受支援的預先配置 Windows Autopilot 設定檔,以及環境中存在的自動部署 Windows Autopilot 設定檔。
下一步:在 設定管理員 建立並發佈 JSON 檔案的套件
相關內容
欲了解更多關於建立 JSON 檔案的資訊,請參閱以下文章: