Add-DhcpServerv4Lease

Add-DhcpServerv4Lease

Adds a new IPv4 address lease in the Dynamic Host Configuration Protocol (DHCP) server service.

Syntax

Parameter Set: Add0
Add-DhcpServerv4Lease [-ScopeId] <IPAddress> [-IPAddress] <IPAddress> [-ClientId] <String> [-AddressState <String> ] [-AsJob] [-CimSession <CimSession[]> ] [-ClientType <String> ] [-ComputerName <String> ] [-Description <String> ] [-DnsRegistration <String> ] [-DnsRR <String> ] [-HostName <String> ] [-LeaseExpiryTime <DateTime> ] [-NapCapable <Boolean> ] [-NapStatus <String> ] [-PassThru] [-PolicyName <String> ] [-ProbationEnds <DateTime> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-DhcpServerv4Lease cmdlet adds a new IPv4 address lease on the Dynamic Host Configuration Protocol (DHCP) server service. This cmdlet is only supported for DHCP server service running on Windows Server® 2012. This cmdlet is for testing purposes only.

Parameters

-AddressState<String>

Specifies the state of the IPv4 Address lease. The acceptable values for this parameter are: Offered, Active, Declined, Expired, or Inactive. The default value is Active.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<CimSession[]>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ClientId<String>

Specifies the client identifier (ID) to be set on the IPv4 address lease. Windows clients use the MAC address as the client ID.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ClientType<String>

Specifies the type of the client. The acceptable values for this parameter are: Unspecified, DHCP, BootP, Both, Reservation, or None.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ComputerName<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Description<String>

Specifies the description string to be set on the IPv4 address lease.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-DnsRegistration<String>

Indicates the status of the DNS registration of the lease.
The acceptable values for this parameter are:
- Complete: For an active lease, registration of the required records , as specified by the DnsRR parameter value of PTR or AandPTR, is complete.
- - For an expired lease, deletion of the required records has been done.
- Pending: For an active lease, registration of the required records, as specified by the DnsRR parameter value of PTR or AandPTR, is pending.
- - For an expired lease, deletion of the required records is pending.
- Not applicable: When the DnsRR parameter is set to NoRegistration such as when no dynamic DNS registration is to be performed by the DHCP server service, this parameter is set to Not applicable.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-DnsRR<String>

Indicates the type of DNS record to be registered by the DHCP server service for this lease. The acceptable values for this parameter are:
- PTR: Only PTR record to be registered by the DHCP server service.
- AandPTR: Both A and PTR records to be registered by the DHCP server service.
- NoRegistration: No DNS registration is done by the DHCP server service. If the dynamic DNS is turned off on the DHCP server service, then this parameter is set to NoRegistration.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-HostName<String>

Specifies the DNS host name of the client for which the IP address lease is to be added.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-IPAddress<IPAddress>

Specifies the IPv4 Address for which the IPv4 address lease record is to be added on the DHCP server service.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-LeaseExpiryTime<DateTime>

Specifies the expiry time of the IPv4 address lease.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-NapCapable<Boolean>

Indicates that the client is network access protection (NAP) capable. The acceptable values for this parameter are: True or False.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-NapStatus<String>

Specifies the NAP status of the client. The acceptable values for this parameter are: NoQuarantine, RestrictedAccess, DropPacket, Probation, Exempt, DefaultQuarSetting, or NoQuarInfo. The default value is NoQuarantine.
If this parameter is specified as Probation and a probation period is not specified, then this cmdlet will return an error.
If this parameter is not specified or is specified as something other than Probation and probation period is not specified, then the probation period to set to 0.
If this parameter is not specified and probation period is specified, then this parameter is set to Probation.
If this parameter is not specified or is specified as something other than Probation and the ProbationEnds parameter is specified, then this cmdlet will return an error.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PolicyName<String>

Specifies the name of the policy to be set on the IPv4 address lease record being added.
Note: The DHCP server service does not check whether the policy specified exists on the server.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ProbationEnds<DateTime>

Specifies the end-time of probation to be set on the IPv4 address lease record.
The default value is 0.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ScopeId<IPAddress>

Specifies the subnet mask to be set on the IPv4 address lease record being added.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DHCP/DhcpServerv4Lease

    The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DHCP/DhcpServerv4Lease

    The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.

Examples

EXAMPLE 1

This example adds an IPv4 address lease for the IPv4 address 10.10.10.11 on the DHCP server service running on the local computer.

PS C:\> Add-DhcpServerv4Lease -IPAddress 10.10.10.11 -ScopeId 10.10.10.0 -ClientId F0-DE-F1-7A-00-5E -LeaseExpiryTime "2012-01-28 01:38:13Z" -HostName MyComputer.contoso.com

Get-DhcpServerv4Lease

Remove-DhcpServerv4Lease