Import-DhcpServer

Import-DhcpServer

Imports the Dynamic Host Configuration Protocol (DHCP) server service configuration, and optionally lease data, from the specified file.

구문

Parameter Set: Default
Import-DhcpServer [-File] <String> [-BackupPath] <String> [-CimSession <CimSession> ] [-ComputerName <String> ] [-Force] [-Leases] [-Prefix <IPAddress[]> ] [-ScopeId <IPAddress[]> ] [-ScopeOverwrite] [-ServerConfigOnly] [ <CommonParameters>]

자세한 설명

The Import-DhcpServer cmdlet imports the Dynamic Host Configuration Protocol (DHCP) server service configuration, and optionally lease data, from the specified file. This cmdlet is only supported for the DHCP server services running on Windows Server® 2012.

If either the ScopeId or the Prefix parameter, or the ScopeId and Prefix parameters are specified, then only the specified scopes or prefixes will be imported.

If neither the ScopeId nor the Prefix parameter is specified, then all of the configurations contained in the file, and optionally any lease data, will be imported.

If the Leases parameter is specified, then the lease data in the specified file is imported in addition to configuration data.

If the ScopeOverWrite parameter is specified and the scope being imported exists on the destination server, then the scope on the target DHCP server service will be overwritten. If this parameter is not specified and the scope being imported exists on the destination DHCP server service, then a warning message is displayed and the import will proceed to process the next scope being imported.

If the ServerConfigOnly parameter is specified, then only the server level configuration will be imported on the destination DHCP server service. If the file specified contains any scope information, then the same information will not be imported on the destination DHCP server service.

매개 변수

-BackupPath<String>

Specifies the path where DHCP server database is backed up before making any configuration changes as part of the import operation.

별칭

없음

필수 여부

true

위치

2

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-CimSession<CimSession>

원격 세션에서 또는 원격 컴퓨터에서 cmdlet을 실행합니다. New-CimSession 또는 Get-CimSession cmdlet의 출력과 같은 컴퓨터 이름이나 세션 개체를 입력합니다. 기본값은 로컬 컴퓨터의 현재 세션입니다.

별칭

Session

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ComputerName<String>

Specifies the DNS name, or IPv4 or IPv6 address, of the target computer running the DHCP server service.

별칭

Cn

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-File<String>

Specifies the name of the file from which the data will be imported. If a complete file path is not specified, then the file will be read from the current working directory.

별칭

없음

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Force

사용자 확인을 요구하지 않고 명령을 실행합니다.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Leases

Specifies that the lease data will also be imported.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Prefix<IPAddress[]>

Specifies the subnet prefixes of IPv6 scopes which are to be imported.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ScopeId<IPAddress[]>

Specifies the scope identifiers (IDs), in IPv4 address format, which need to be imported.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ScopeOverwrite

Specifies that, if the scope being imported exists on the target server, the scope on the destination DHCP server service will be overwritten.
If this parameter is not specified and the scope being imported exists on the destination DHCP server service, then a warning message is displayed and import will proceed to process the next scope being imported.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ServerConfigOnly

Specifies that only server level configuration will be imported on the destination DHCP server service. If the file specified contains any scope information, then the same will not be imported on the destination DHCP server service.
Both DHCPv4 and DHCPv6 server level configurations will be imported.
The server level configuration comprises of (both v4 and v6):
-- Class definitions.
-- Option definitions.
-- Option values.
-- Server level Policies (DHCPv4).
-- MAC address filters (DHCPv4).
-- Other Server Properties (ConflicDetectionAttempts, DHCPv6 stateless store).

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • None

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • None

예제

EXAMPLE 1

This example imports the configuration data in the specified file onto the DHCP server service running one the computer named dhcpserver.contoso.com. The file can contain DHCPv4 as well as DHCPv6 configuration data.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\

EXAMPLE 2

This example imports the configuration and lease data in the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. The file can contain DHCPv4 as well as DHCPv6 configuration data.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -Leases

EXAMPLE 3

This example imports the configuration data for scopes 10.10.10.0 and 20.20.20.0 from the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. If the export file contains scopes besides 10.10.10.0 and 20.20.20.0, then those scopes are ignored. The DHCPv4 server level configuration data, if present in the export file, is also imported onto the DHCP server service.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -ScopeId 10.10.10.0,20.20.20.0

EXAMPLE 4

This example imports the configuration and lease data for scopes 10.10.10.0 and 20.20.20.0 from the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. If the export file contains scopes besides 10.10.10.0 and 20.20.20.0, then those scopes are ignored. The DHCPv4 server level configuration data, if present in the export file, is also imported onto the DHCP server service.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -ScopeId 10.10.10.0,20.20.20.0 -Leases

EXAMPLE 5

This example imports the configuration and lease data for scopes 10.10.10.0 and 20.20.20.0 from the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. If the export file contains scopes besides 10.10.10.0 and 20.20.20.0, then those scopes are ignored. The DHCPv4 server level configuration data, if present in the export file, is also imported onto the server. If the scopes 10.10.10.0 and 20.20.20.0 are already present on the DHCP server service running one the computer named dhcpserver.contoso.com, then the scopes are deleted and recreated from the data in the export file.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -ScopeId 10.10.10.0,20.20.20.0 -Leases -ScopeOverwrite

EXAMPLE 6

This example imports only the server level configuration data in the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. Any scope configuration data, if present in the file, is ignored.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -ServerConfigOnly

EXAMPLE 7

This example imports the configuration data for scopes 2001:4898:7020:1020:: and 2001:4898:7020:1030:: from the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. If the export file contains scopes besides 2001:4898:7020:1020:: and 2001:4898:7020:1030::, then those scopes are ignored. The DHCPv6 server level configuration data, if present in the export file, is also imported onto the DHCP server service.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -Prefix 2001:4898:7020:1020::,2001:4898:7020:1030::

EXAMPLE 8

This example imports the configuration and lease data for scopes 2001:4898:7020:1020:: and 2001:4898:7020:1030:: from the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. If the export file contains scopes besides 2001:4898:7020:1020:: and 2001:4898:7020:1030::, then those scopes are ignored. The DHCPv6 server level configuration data, if present in the export file, is also imported onto the DHCP server service.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -Prefix 2001:4898:7020:1020::,2001:4898:7020:1030:: -Leases

EXAMPLE 9

This example imports the configuration and lease data for scopes 2001:4898:7020:1020:: and 2001:4898:7020:1030:: from the specified file onto the DHCP server service running on the computer named dhcpserver.contoso.com. If the export file contains scopes besides 2001:4898:7020:1020:: and 2001:4898:7020:1030::, then those scopes are ignored. The DHCPv6 server level configuration data, if present in the export file, is also imported onto the DHCP server service. If the scopes 2001:4898:7020:1020:: and 2001:4898:7020:1030:: are already present on the DHCP server service running on the computer named dhcpserver.contoso.com, then the scopes are deleted and recreated from the data in the export file.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exports\dhcpexport.xml -BackupPath C:\dhcpbackup\ -Prefix 2001:4898:7020:1020::,2001:4898:7020:1030:: -Leases -ScopeOverwrite

EXAMPLE 10

This example imports a list of scopes specified in file named ScopeList.txt to the DHCP server service running on the computer named dhcpserver.contoso.com.
The file named ScopeList.txt should contain the following format:
ScopeID
10.10.10.0
20.20.20.0
30.30.30.0

The Import-Csv cmdlet gets the list of scopes to import and returns it in the variable named $scopeIdList.

PS C:\> $scopeIdList = Import-Csv –Path .\ScopeList.txt

This cmdlet imports the scopes using the variable named $scopeIdList as input for the ScopeId parameter.

PS C:\> Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:\exportdir\dhcpexport.xml -Leases -ScopeId $scopeIdList.ScopeId -BackupPath C:\dhcpbackup\

관련 항목

Backup-DhcpServer

Export-DhcpServer

Restore-DhcpServer

Import-Csv