在另一部伺服器匯入匯出 NPS 伺服器設定Export an NPS Server Configuration for Import on Another Server

適用於:Windows Server 2016Applies To: Windows Server 2016

您可以將匯出整個 NPS 設定,包括戶端 RADIUS 伺服器、網路原則、連接要求原則、登錄,並登入設定,從在另一部 NPS 伺服器匯入一個 NPS 伺服器。You can export the entire NPS configuration — including RADIUS clients and servers, network policy, connection request policy, registry, and logging configuration — from one NPS server for import on another NPS server.

您可以使用其中一項下列工具來匯出 NPS 設定:Use one of the following tools to export the NPS configuration:

  • Windows Server 2016、Windows Server 2012 R2,以及 Windows Server 2012,您可以使用 Netsh,或您可以使用 Windows PowerShell。In Windows Server 2016, Windows Server 2012 R2, and Windows Server 2012, you can use Netsh, or you can use Windows PowerShell.
  • 在 Windows Server 2008 R2 和 Windows Server 2008、使用 Netsh。In Windows Server 2008 R2 and Windows Server 2008, use Netsh.

重要

如果來源 NPS 資料庫具有更高版本號碼比目的 NPS 資料庫的版本號碼,請使用此程序。Do not use this procedure if the source NPS database has a higher version number than the version number of the destination NPS database. 您可以檢視 NPS 資料庫中顯示的版本號碼netsh nps 顯示設定命令。You can view the version number of the NPS database from the display of the netsh nps show config command.

因為 NPS 伺服器設定未加密匯出 XML 檔案,在傳送該網路可能的安全性風險,因此時帶上預防措施 XML 檔案的來源伺服器前往目的地的伺服器。Because NPS server configurations are not encrypted in the exported XML file, sending it over a network might pose a security risk, so take precautions when moving the XML file from the source server to the destination servers. 例如,檔案中加入檔案已加密,密碼受保護的保存日前檔案。For example, add the file to an encrypted, password protected archive file before moving the file. 此外,請將檔案儲存在安全的位置,以防止惡意使用者存取。In addition, store the file in a secure location to prevent malicious users from accessing it.

注意

如果來源 NPS 伺服器上設定 SQL Server 登入,則是不會 XML 檔案匯出 SQL Server 登入設定。If SQL Server logging is configured on the source NPS server, SQL Server logging settings are not exported to the XML file. 匯入另一個 NPS 伺服器上的檔案之後,您必須手動設定 SQL Server 登入。After you import the file on another NPS server, you must manually configure SQL Server logging.

匯出與匯入 NPS 設定,請使用 Windows PowerShellExport and Import the NPS configuration by using Windows PowerShell

適用於 Windows Server 2012 和較新的作業系統版本,您可以匯出使用 Windows PowerShell NPS 設定。For Windows Server 2012 and later operating system versions, you can export the NPS configuration using Windows PowerShell.

以下是命令語法匯出 NPS 設定。The command syntax for exporting the NPS configuration is as follows.

Export-NpsConfiguration -Path <filename>

下表列出參數適用於匯出-NpsConfiguration在 Windows PowerShell cmdlet。The following table lists parameters for the Export-NpsConfiguration cmdlet in Windows PowerShell. 是必要的參數以粗體顯示。Parameters in bold are required.

參數Parameter 描述Description
路徑Path 指定您要匯出 NPS 伺服器設定 XML 檔案的位置與名稱。Specifies the name and location of the XML file to which you want to export the NPS server configuration.

管理認證Administrative credentials

若要完成此程序,您必須是系統管理員群組成員。To complete this procedure, you must be a member of the Administrators group.

匯出範例Export Example

以下的範例、NPS 設定匯出到本機磁碟機上 XML 檔案。In the following example, the NPS configuration is exported to an XML file located on the local drive. 若要執行這個命令時,以系統管理員身分執行來源 NPS 伺服器上的 Windows PowerShell、輸入下列命令,並按下 Enter。To run this command, run Windows PowerShell as Administrator on the source NPS server, type the following command, and press Enter.

Export-NpsConfiguration –Path c:\config.xml

如需詳細資訊,請查看匯出-NpsConfigurationFor more information, see Export-NpsConfiguration.

您有匯出 NPS 設定之後,將 XML 檔案複製到目的伺服器。After you have exported the NPS configuration, copy the XML file to the destination server.

匯入 NPS 設定目的伺服器上的命令語法如下所示。The command syntax for importing the NPS configuration on the destination server is as follows.

Import-NpsConfiguration [-Path] <String> [ <CommonParameters>]

匯入範例Import Example

下列命令從匯入到 NPS C:\Npsconfig.xml 名為的檔案。The following command imports settings from the file named C:\Npsconfig.xml to NPS. 若要執行這個命令時,目的 NPS 伺服器以系統管理員身分執行 Windows PowerShell、輸入下列命令,並按下 Enter。To run this command, run Windows PowerShell as Administrator on the destination NPS server, type the following command, and press Enter.

PS C:\> Import-NpsConfiguration -Path "C:\Npsconfig.xml"

如需詳細資訊,請查看NpsConfiguration 匯入的For more information, see Import-NpsConfiguration.

匯出與匯入 NPS 設定使用 NetshExport and Import the NPS configuration by using Netsh

您可以使用網路殼層 (Netsh) 匯出 NPS 伺服器設定使用netsh nps 匯出命令。You can use Network Shell (Netsh) to export the NPS server configuration by using the netsh nps export command.

netsh nps 匯入命令的執行、NPS 的更新的設定自動更新。When the netsh nps import command is run, NPS is automatically refreshed with the updated configuration settings. 您不需要停止 NPS 目的地電腦上執行netsh nps 匯入命令,但是如果 NPS 主機或 NPS MMC 嵌入式管理單元,開放設定匯入期間伺服器設定的變更不見直到您重新整理檢視。You do not need to stop NPS on the destination computer to run the netsh nps import command, however if the NPS console or NPS MMC snap-in is open during the configuration import, changes to the server configuration are not visible until you refresh the view.

注意

當您使用netsh nps 匯出命令時,會要求您提供命令的參數exportPSK的值[是]When you use the netsh nps export command, you are required to provide the command parameter exportPSK with the value YES. 此參數和值明確狀態,您知道,您要匯出 NPS 伺服器設定,並包含匯出之的 XML 檔案加密共用的密碼 RADIUS 戶端和遠端 RADIUS 伺服器群組成員。This parameter and value explicitly state that you understand that you are exporting the NPS server configuration, and that the exported XML file contains unencrypted shared secrets for RADIUS clients and members of remote RADIUS server groups.

管理認證Administrative credentials

若要完成此程序,您必須是系統管理員群組成員。To complete this procedure, you must be a member of the Administrators group.

NPS 伺服器設定複製到另一個 NPS 伺服器使用 Netsh 命令To copy an NPS server configuration to another NPS server using Netsh commands

  1. 在來源 NPS 伺服器,請打開命令提示字元,輸入netsh,然後按 Enter 鍵。On the source NPS server, open Command Prompt, type netsh, and then press Enter.

  2. netsh提示,輸入nps,然後按 Enter 鍵。At the netsh prompt, type nps, and then press Enter.

  3. netsh nps提示,請輸入匯出檔案名稱 =path\file.xml] exportPSK = 是,其中路徑是您想要儲存 NPS 伺服器設定檔的資料夾位置和檔案是您想要儲存 XML 檔案的名稱。At the netsh nps prompt, type export filename="path\file.xml" exportPSK=YES, where path is the folder location where you want to save the NPS server configuration file, and file is the name of the XML file that you want to save. 按 Enter。Press Enter.

這會將設定儲存 (including registry settings) XML 檔案。This stores configuration settings (including registry settings) in an XML file. 路徑可以相關或完全一致,或通用命名規格 (UNC) 路徑。The path can be relative or absolute, or it can be a Universal Naming Convention (UNC) path. 按下 Enter 後,會顯示訊息表示是否成功匯出檔案。After you press Enter, a message appears indicating whether the export to file was successful.

  1. 將您建立的檔案複製到目的 NPS 伺服器。Copy the file you created to the destination NPS server.

  2. 目的地 NPS 伺服器上命令提示字元中,輸入netsh nps 匯入檔案名稱 =]path\file.xml」,然後按 Enter 鍵。At a command prompt on the destination NPS server, type netsh nps import filename="path\file.xml", and then press Enter. 就會顯示訊息表示是否 XML 檔案從匯入成功。A message appears indicating whether the import from the XML file was successful.

如需 netsh 的詳細資訊,請查看網路 Shell (Netsh)For more information about netsh, see Network Shell (Netsh).