Edit

Share via


Add-DhcpServerv4Lease

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

Syntax

Default (Default)

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.

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.

Parameter properties

Type:String
Default value:None
Accepted values:Active, Declined, Expired, ActiveReservation, InactiveReservation
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Session

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ClientId

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ClientType

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

Parameter properties

Type:String
Default value:None
Accepted values:UnSpecified, Dhcp, BootP, None, Both
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ComputerName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Cn

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Description

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Accepted values:Complete, Pending, NotApplicable
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Accepted values:A, PTR, AandPTR, NoRegistration
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-HostName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IPAddress

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

Parameter properties

Type:IPAddress
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LeaseExpiryTime

Specifies the expiry time of the IPv4 address lease.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NapCapable

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

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Accepted values:FullAccess, RestrictedAccess, DropPacket, InProbation, Exempt, DefaultQuarantineSetting, NoQuarantineInfo
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PassThru

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ProbationEnds

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

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ScopeId

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

Parameter properties

Type:IPAddress
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

CimInstance

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

CimInstance

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.