共用方式為


現有裝置的 Windows Autopilot 部署:建立 Autopilot 設定檔的 JSON 檔案 ()

Autopilot 使用者驅動Microsoft Entra加入步驟:

  • 步驟 3:建立 Autopilot 設定檔的 JSON 檔案 ()

如需現有裝置的 Windows Autopilot 部署工作流程概觀,請參閱Intune 中現有裝置的 Windows Autopilot 部署和Configuration Manager

建立 Autopilot 設定檔的 JSON 檔案 ()

注意事項

本節中的 PowerShell 程式碼片段已在 2023 年 7 月更新為使用 Microsoft Graph PowerShell 模組,而不是已淘汰的 AzureAD Graph PowerShell 模組。 第一次使用 Microsoft Graph PowerShell 模組時,可能需要核准Microsoft Entra識別碼中的其他許可權。 如需詳細資訊,請參閱 AzureAD重要事項:Azure AD Graph 淘汰和 PowerShell 模組淘汰

安裝適當的模組以允許從 Intune 匯出 Autopilot 設定檔 () 之後,下一個步驟是將 Autopilot 設定檔匯出為 JSON 檔案。 JSON 檔案可用來在 Configuration Manager 中建立套件。

若要將 Autopilot 設定檔匯出為 JSON 檔案,請遵循下列步驟:

  1. 登入 Configuration Manager 月臺伺服器或其他裝置,其中已在安裝必要的模組中安裝必要的模組,以從 Intune 取得 Autopilot 設定檔 ()

  2. 在裝置上,以系統管理員身分開啟 PowerShell 視窗,方法是以滑鼠右鍵按一下 [開始] 功能表,然後選取 [Windows PowerShell (管理員) /Windows 終端機 (管理員) ],然後在 [使用者帳戶控制] (UAC) 提示中選取 []。

  3. 選取下列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"
    }
    
  4. 將命令貼到提升許可權的 PowerShell 視窗中,然後在鍵盤上選取 Enter 以執行命令。 如果提升許可權的 PowerShell 命令視窗尚未登入 Intune,則會出現 [ 登入您的帳戶 ] 視窗。 使用可存取 Intune 和 Autopilot 設定檔的Microsoft Entra帳戶登入。

  5. 登入 Intune 之後,您可能需要再次選取 Enter ,才能在程式碼區塊中執行最後一個命令。

  6. 一旦所有命令都順利執行,Autopilot 設定檔 (的) 就會出現在變數所指定資料夾下的子資料夾中 $targetDirectory 。 根據預設,變 $targetDirectory 量為 C:\AutoPilot ,但可視需要變更為另一個位置。 子資料夾具有來自 Intune 的 Autopilot 設定檔名稱。 如果有多個 Autopilot 設定檔,則每個設定檔都有自己的子資料夾。 在每個資料夾中,都有一個名為 的 AutopilotConfigurationFile.json JSON 檔案。

注意事項

上述腳本會從 Intune 匯出所有 Autopilot 設定檔。 除了支援的使用者驅動 Autopilot 設定檔之外,它也會下載不支援的預先布建 Autopilot 設定檔,並在環境中有自動部署的 Autopilot 設定檔。

下一個步驟:在 Configuration Manager 中建立和散發 JSON 檔案的套件

其他相關資訊

如需建立 JSON 檔案的詳細資訊,請參閱下列文章 (的) :