Add-Dhcp Serverv4Lease

Adds a new IPv4 address lease in the DHCP server service.

Syntax

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

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 that runs on Windows Server® 2012. This cmdlet is for testing purposes only.

Examples

Example 1: Add an Ipv4 lease on the DHCP server service

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"

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

Required Parameters

-ClientId

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

Type: String
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-IPAddress

Specifies the IPv4 address for which the IPv4 address lease record to add on the DHCP server service.

Type: IPAddress
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-ScopeId

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

Type: IPAddress
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

Optional Parameters

-AddressState

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

Type: String
Parameter Sets: Active, Declined, Expired, ActiveReservation, InactiveReservation
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete. The cmdlet immediately returns an object that represents the job and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the *-Job cmdlets. To get the job results, use the Receive-Job cmdlet. For more information about Windows PowerShell® background jobs, see about_Jobs .

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-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.

Type: CimSession[]
Aliases: Session
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ClientType

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

Type: String
Parameter Sets: UnSpecified, Dhcp, BootP, None, Both
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-ComputerName

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

Type: String
Aliases: Cn
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Aliases: cf
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Description

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

Type: String
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-DnsRR

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 performed by the DHCP server service. If the dynamic DNS is turned off on the DHCP server service, this parameter is set to NoRegistration.
Type: String
Parameter Sets: A, PTR, AandPTR, NoRegistration
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-DnsRegistration

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 is complete.
  • 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.
    • If 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.
Type: String
Parameter Sets: Complete, Pending, NotApplicable
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-HostName

Specifies the DNS host name of the client for which the IP address lease to add.

Type: String
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-LeaseExpiryTime

Specifies the expiry time of the IPv4 address lease.

Type: DateTime
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-NapCapable

Indicates that the client is network access protection (NAP) capable.

Type: Boolean
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-NapStatus

Specifies the NAP status of the client. The acceptable values for this parameter are: NoQuarantine, RestrictedAccess, DropPacket, Probation, Exempt, DefaultQuarSetting, and NoQuarInfo. The default value is NoQuarantine.

If you specify this parameter as Probation and a probation period is not specified, this cmdlet returns an error.

If you do not specify this parameter or specified it as something other than Probation and probation period is not specified, the probation period to set to 0.

If you do not specify this parameter and a probation period is specified, this parameter is set to Probation.

If you do not specify this parameter or specify it something other than Probation and the ProbationEnds parameter is specified, this cmdlet returns an error.

Type: String
Parameter Sets: FullAccess, RestrictedAccess, DropPacket, InProbation, Exempt, DefaultQuarantineSetting, NoQuarantineInfo
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.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PolicyName

Specifies the name of the policy to be set on the IPv4 address lease record that is added.

The DHCP server service does not check whether the policy specified exists on the server.

Type: String
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-ProbationEnds

Specifies the end-time of probation to be set on the IPv4 address lease record.

Type: DateTime
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-ThrottleLimit

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.

Type: Int32
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf

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

Type: SwitchParameter
Aliases: wi
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

Inputs

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

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.