共用方式為


在 Windows 中設置 EAP 設置檔和設置

適用於:Windows Server 2022、Windows 11、Windows 10

本文介紹設置可擴充身份驗證協定 (EAP) 設置的常用不同方法的資訊。 具體來說,它描述了使用 XML 和命令列工具來設置 EAP 設置檔。 它還展示瞭如何使用 Windows 中的各種 UI 設置 EAP 設置和設置檔。

XML 設定檔

如 EAP 的 XML 設置檔所述,Wi-Fi、乙太網路和 VPN 的連線設置檔是包含該連線的設置選項的 XML 檔案。 這些設置檔可以匯入/匯出並手動編輯。 在 UI 中建立或編輯設置檔時(如以下各節所述),Windows 在內部設置對應的 XML 設置選項。 因此,您可以使用 UI 建立設置資料,然後將其匯出以查閱設置的 XML 設置選項。

注意

並非每個設置選項都會在 UI 中公開。 依據您的情境,可能需要手動編輯 XML 設置檔以設置所需的設置選項,然後匯入更新的設置檔以進行部署。

例如,當使用行動裝置管理 (MDM) 策略(例如 Wi-Fi CSP)時,您需要設置完整的 XML 設置檔。

在此範例中可以找到 Wi-Fi 設置檔的範例

使用命令列工具匯入和匯出設置資料

使用命令列工具匯入和匯出設置檔在許多情況下都非常有用。 例如,當無法設置 MDM 或群組原則時,手動或編寫這些命令的腳本可能是最快的選擇。 它還可用於在透過其他 UI 設置設置檔後匯出設置檔。

netsh

netsh是一個命令列工具,可用於檢視和設置各種網路相關設置。 更多詳細資訊,請參閱網路 shell (netsh)netsh可以從cmdpowershell調用。 下表列出了一些netsh用於匯入和匯出設置檔的常用命令和範例。 /?可以與任何命令一起netsh使用以獲取有關該命令的更多資訊,包括語法。

Command 描述
netsh wlan show profiles 顯示所有 Wi-Fi 設置資料,包括設置檔名稱。
netsh wlan show profiles name="ProfileName" 顯示有關特定 Wi-Fi 設置檔的詳細資訊
netsh wlan export profile name="ProfileName" folder="C:\Profiles" 將 Wi-Fi 設置檔匯出到指定資料夾。 該資料夾必須存在。
netsh wlan add profile filename="C:\Profiles\ProfileName.xml" 從指定檔案新增 Wi-Fi 設置檔。
netsh wlan delete profile name="ProfileName" 刪除 Wi-Fi 設置檔。

PowerShell

PowerShell 是一種命令列 shell 和腳本語言,可用於檢視和設置各種設置。 它包括可用於匯入和匯出連接設置檔的各種命令 (cmdlet)。 Get-Help cmdlet 可以與任何 cmdlet 一起使用,以獲取有關該 cmdlet 的更多資訊,包括語法。

更多關於這些 cmdlet 的詳細資訊,請參閱 Get-VpnConnectionSet-VpnConnection Add-VpnConnection

Command 描述
Get-VpnConnection 顯示所有 VPN 設置資料,包括設置檔名稱和其他詳細資訊。
Get-VpnConnection -Name "ProfileName" 顯示有關特定 VPN 設置檔的摘要資訊。
(Get-VpnConnection -Name "ProfileName").EapConfigXmlStream.InnerXml \| Out-File -FilePath "C:\Profiles\vpn_eap.xml" 將特定 VPN 設置檔的 EAP 設置匯出到檔案。
Set-VpnConnection -Name "ProfileName" -EapConfigXmlStream (Get-Content -Path "C:\Profiles\vpn_eap.xml") 從檔案匯入 EAP 設置並用它更新指定的 VPN 設置檔。

設置應用程式(桌面 Windows)

在 Windows 桌面使用者端上,可以透過「設置」應用程式設置許多常見的 Wi-Fi、乙太網路和 VPN 設置。 以下螢幕截圖顯示了 Windows 11 設置應用程序,但 Windows 10 中的 UI 類似。 但是,某些功能和選項可能僅在 Windows 11 中可用。

Windows 10 和 11 支援在「設置」應用程式中新增具有特定設置(包括 802.1X)的 Wi-Fi 設置檔。 此設置可在設置應用程式中的網路 2 &網際網路 >Wi-Fi >管理已知網路>新增網路下找到:Screenshot of Network & internet page on Windows 11 settings app.Screenshot of Wi-Fi page on Windows 11 settings app.Screenshot of Manage known networks page on Windows 11 settings app.Screenshot of Add a new network dialog in Windows 11 settings app.

此對話框可讓您設置 Wi-Fi 設置檔的 SSID、安全性類型和其他設置。 當選擇支援 EAP 的安全性類型,例如 WPA3-Enterprise AES 時,該對話框將顯示用於設置 EAP 設置的選項:Screenshot of Add a new network dialog, showing WPA3-Enterprise and EAP-TLS, on Windows 11 settings app.

提示

新增網路後,將無法透過「設置」應用程式編輯 EAP 設置。 若要編輯 EAP 設置,請執行下列任一操作:

  • 刪除設置檔並使用正確的設置重新新增它,或者
  • 使用 netshnetsh 中描述的命令手動編輯設置檔。

Group Policy Editor(桌面和伺服器)

Group Policy 是一種基礎結構,可讓您管理使用者和電腦的設置。 使用 Group Policy,您可以依據您設置的規則設置 Wi-Fi、乙太網路和 VPN 設置。 以下螢幕截圖顯示了 Windows Server 2022 Group Policy Management Editor,但桌面 Windows 的控制台和本機群組原則編輯器的 UI 類似。 有關以下螢幕截圖中顯示的選項的詳細資訊,請參閱用於網路存取的 Extensible Authentication Protocol (EAP)

Wi-Fi 的群組原則選項位於 Computer Configuration >Policies >Windows Settings >安全設置>Wireless Network (IEEE 802.11) PoliciesScreenshot showing Wireless Network (IEEE 802.11) Policies option in Group Policy Management Editor.

右鍵點選 Wireless Network (IEEE 802.11) Policies並選擇Create A New Wireless Network Policy for Windows Vista and Later Releases opens the New Wireless Network Policy Properties dialog: Screenshot showing Create A New Wireless Network Policy for Windows Vista and Later Releases option in Group Policy Management Editor.Screenshot showing the New Wireless Network Policy Properties dialog.

此對話框可讓您設置策略名稱、描述、Add/Edit/Remove 設置檔以及匯入匯出 XML 設置檔

點選新增並選擇Infrastructure將開啟新設置檔屬性對話框:Screenshot showing the New Profile properties dialog.

此對話框可讓您設置設置檔名稱並新增此設置檔適用的 SSID。

選擇安全性可讓您設置設置檔的 EAP 設置:Screenshot showing the Security tab of the New Profile properties dialog.

此對話框可讓您設置 Wi-Fi 設置檔的安全性類型和其他設置。 當選擇支援 802.1X 驗證的驗證類型(例如 WPA2-Enterprise)時,802.1X 安全性選項可見。 有關每種網路身份驗證方法的詳細資訊,請參閱 EAP 方法。

選擇進階...點選鈕後,將顯示 Advanced Security Settings 對話框:Screenshot showing the Advanced security settings dialog for Wi-Fi.

此對話框可讓您設置一些進階 802.1X 設置Single Sign On 選項。

提示

並非所有設置都可在 Group Policy Editor 中進行設置。 但是,可以透過匯入具有所需設置的 XML 設置檔來解決此問題。 更多詳細資訊,請參閱 XML 設置檔

EAP 方法

有關不同 EAP 方法的概述,請參閱身份驗證方法

Microsoft:智慧卡或其他證書

有關此對話框的更多資訊,請參閱 EAP-TLSScreenshot showing the Smart Card or other certificate Properties dialog.

選擇進階將開啟 Configure Certificate Selection對話框:Screenshot showing the Configure Certificate Selection dialog.

Microsoft:受保護的 EAP (PEAP)

有關此對話框的詳細資訊,請參閱 PEAPScreenshot showing the Protected EAP Properties dialog.

選擇安全密碼 (EAP-MSCHAP v2)時選擇設置...將開啟 EAP MSCHAPv2 對話框:Screenshot showing the EAP MSCHAPv2 Properties dialog.

Microsoft:EAP-SIM

有關此對話框的詳細資訊,請參閱 EAP-SIMScreenshot showing the EAP-SIM Properties dialog.

Microsoft:EAP-TTLS

有關此對話框的詳細資訊,請參閱 EAP-TTLSScreenshot showing the TTLS Properties dialog.

Microsoft:EAP-AKA

有關此對話框的更多資訊,請參閱 EAP-AKAScreenshot showing the EAP-AKA Properties dialog.

Microsoft:EAP-AKA'

有關此對話框的更多資訊,請參閱 EAP-AKA'Screenshot showing the EAP-AKA' Properties dialog.

Microsoft:EAP-TEAP

有關此對話框的更多資訊,請參閱 TEAPScreenshot showing the TEAP Properties dialog.

其他資源