共用方式為


現有裝置的 Windows Autopilot 部署:安裝必要的模組,以從 Intune 取得 Windows Autopilot 配置檔

Windows Autopilot 使用者驅動 Microsoft Entra 聯結步驟:

  • 步驟 2:安裝必要的模組,以從 Intune 取得 Windows Autopilot 配置檔

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

安裝必要的模組,以從 Intune 取得 Windows Autopilot 配置檔

注意事項

本節中的 PowerShell 程式碼片段已於 2023 年 7 月更新,以使用 Microsoft Graph PowerShell 模組,而不是已取代的 AzureAD Graph PowerShell 模組。 第一次使用 Microsoft Graph PowerShell 模組時,可能需要核准 Microsoft Entra ID 中的其他許可權。 程式碼片段也已更新,以強制使用更新版本的 WindowsAutoPilot 模組。 如需詳細資訊,請參閱 AzureAD重要:Azure AD Graph 淘汰和 PowerShell 模組淘汰

確定有有效的 Windows Autopilot 配置檔之後,下一個步驟是從 Intune 下載現有的 Windows Autopilot 配置檔作為 JSON 檔案。 JSON 檔案包含 Intune 租使用者和 Windows Autopilot 配置檔的所有相關資訊。 從 Intune 下載 JSON 檔案之後,會建立包含 JSON 檔案的 Configuration Manager 套件。 然後,Configuration Manager 套件會在現有裝置的 Windows Autopilot 部署工作順序期間,在裝置上安裝 JSON 檔案。

JSON 檔案會在 Configuration Manager 工作順序的 WinPE 部分期間安裝在裝置上,以離線 Windows 安裝。 JSON 檔案可讓 Windows Autopilot 配置檔可供 Windows 現成體驗 (OOBE) ,以便在第一次啟動 Windows 時執行 Windows Autopilot 部署。 JSON 檔案可讓 Windows OOBE 先從 Intune 下載 Windows Autopilot 配置檔。

注意事項

Windows OOBE 仍會檢查是否有任何指派給裝置的 Windows Autopilot 配置檔,即使有 JSON 檔案也一樣。 如果裝置是 Windows Autopilot 裝置,且已指派給裝置的 Windows Autopilot 配置檔,則會從 Intune 下載 Windows Autopilot 配置檔,並使用,而不是 JSON 檔案。

在將 Windows Autopilot 配置檔從 Intune 下載為 JSON 檔案之前,必須在要下載 Windows Autopilot 配置檔的裝置上安裝某些模組。 需要這些模組,才能從 Intune 取得 Windows Autopilot 配置檔。 針對本教學課程,為了簡化程式,這些模組的安裝會在 Configuration Manager 月臺伺服器上執行。 不過,可以使用任何可存取 Intune 的裝置。

若要安裝必要的模組,將 Windows Autopilot 配置檔下載為 JSON 檔案,請遵循下列步驟:

  1. 登入 Configuration Manager 月臺伺服器或可存取 Intune 的其他裝置。

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

  3. 選取下列 PowerShell 程式碼區塊右上角的 [複製],以複製下列命令:

    Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
    Install-Module -Name WindowsAutopilotIntune -MinimumVersion 5.4.0 -Force
    Install-Module -Name Microsoft.Graph.Groups -Force
    Install-Module -Name Microsoft.Graph.Authentication -Force
    Install-Module Microsoft.Graph.Identity.DirectoryManagement -Force
    
    Import-Module -Name WindowsAutopilotIntune -MinimumVersion 5.4
    Import-Module -Name Microsoft.Graph.Groups
    Import-Module -Name Microsoft.Graph.Authentication
    Import-Module -Name Microsoft.Graph.Identity.DirectoryManagement
    
  4. 將命令貼到提升許可權的 PowerShell 視窗中,然後選取鍵盤上的 Enter 以執行命令。 可能需要再次選取 Enter 才能執行程式碼區塊中的最後一個命令。 一旦所有命令都成功運行,就會安裝所需的模組。

確認可以檢視 Intune 中的 Windows Autopilot 配置檔

安裝必要的模組之後,可以採取下列步驟來確認可以檢視 Intune 中的 Windows Autopilot 配置檔:

注意事項

下列步驟不會將 Windows Autopilot 設定檔匯出為 JSON 檔案。 它只會確認可以檢視 Windows Autopilot 配置檔。

  1. 選取下列 PowerShell 程式碼區塊右上角的 [複製],以複製下列命令:

    Connect-MgGraph -Scopes "Device.ReadWrite.All", "DeviceManagementManagedDevices.ReadWrite.All", "DeviceManagementServiceConfig.ReadWrite.All", "Domain.ReadWrite.All", "Group.ReadWrite.All", "GroupMember.ReadWrite.All", "User.Read"
    
  2. 將命令貼到提升許可權的 PowerShell 視窗中,然後選取鍵盤上的 Enter 以執行命令。

  3. 登入您的帳戶」 視窗隨即出現。 使用可存取 Intune 和 Windows Autopilot 配置檔的 Microsoft Entra 帳戶登入。

  4. 選取下列 PowerShell 程式碼區塊右上角的 [複製],以複製下列命令:

    Get-AutopilotProfile | ConvertTo-AutopilotConfigurationJSON
    
  5. 將命令貼到提升許可權的 PowerShell 視窗中,然後選取鍵盤上的 Enter 以執行命令。

  6. Intune 中可用的所有 Windows Autopilot 配置檔都會以 JSON 格式顯示在 PowerShell 視窗中。 每個個別的 Windows Autopilot 配置檔都會封裝在大括弧 ({}) 內。

下一個步驟:建立 Windows Autopilot 設定檔的 JSON 檔案

如需安裝必要模組以從 Intune 取得 Windows Autopilot 配置檔的詳細資訊,請參閱下列文章: