Get-DhcpServerv4Lease
Get-DhcpServerv4Lease
Gets one or more lease records from the Dynamic Host Configuration Protocol (DHCP) server service.
Sintaxis
Parameter Set: ScopeId
Get-DhcpServerv4Lease [-ScopeId] <IPAddress> [-AllLeases] [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: BadLeases
Get-DhcpServerv4Lease [[-ScopeId] <IPAddress> ] -BadLeases [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ClientId
Get-DhcpServerv4Lease [-ScopeId] <IPAddress> [-ClientId] <String[]> [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: IPAddress
Get-DhcpServerv4Lease -IPAddress <IPAddress[]> [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Descripción detallada
The Get-DhcpServerv4Lease cmdlet gets one or more lease records from the Dynamic Host Configuration Protocol (DHCP) server service.
If the ScopeId parameter is specified, then the active leases from the specified scope are returned. To get all types of leases including Active, Offered, Declined, and Expired, then the AllLeases parameter must be specified.
If the IPAddress parameter is specified, then the lease records for the specified IP address are returned.
If the ClientId and ScopeId parameters are specified, then the leases for the specified ClientId parameter values in the specified scope are returned.
If the BadLeases and ScopeId parameters are specified, then all of the bad lease records for the specified scope are returned.
If the BadLeases parameter is specified without the ScopeId parameter, then all of the bad lease records from the DHCP server service are returned.
Parámetros
-AllLeases
Specifies that all of the IPv4 address leases regardless of address state are returned.
If not specified, then only active leases are returned.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-AsJob
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-BadLeases
Specifies that only bad leases are returned. If an IP address lease is declined by the client because of a conflict with another client, then the lease record is marked as bad, or declined, by the DHCP server service.
An IP address lease in this state is not offered to any client until expiry of a timer, which is 10 minutes.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-CimSession<CimSession[]>
Ejecuta el cmdlet en una sesión remota o en un equipo remoto. Escriba un nombre de equipo o un objeto de sesión, como la salida de un cmdlet New-CimSession o Get-CimSession. El valor predeterminado es la sesión actual en el equipo local.
Alias |
Session |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-ClientId<String[]>
Specifies the client identifier (ID) for which the IP address lease record is to be retrieved.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
3 |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByPropertyName) |
¿Aceptar caracteres comodín? |
false |
-ComputerName<String>
Specifies the DNS name, or IPv4 or IPv6 address, of the target computer running the DHCP server service.
Alias |
Cn |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-IPAddress<IPAddress[]>
Specifies the IP address for which the lease record is to be retrieved.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByPropertyName) |
¿Aceptar caracteres comodín? |
false |
-ScopeId<IPAddress>
Specifies the scope ID, in IPv4 address format from which the IPv4 address leases are being retrieved.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
2 |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByPropertyName) |
¿Aceptar caracteres comodín? |
false |
-ThrottleLimit<Int32>
Especifica el número máximo de operaciones simultáneas que se pueden establecer para ejecutar el cmdlet. Si se omite este parámetro o es especifica un valor de 0
, Windows PowerShell ® calcula un límite óptimo para el cmdlet en función del número de cmdlets de CIM que se estén ejecutando en el equipo. El límite solo se aplica al cmdlet actual, no a la sesión ni al equipo.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
<CommonParameters>
Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Entradas
El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.
Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DHCP/DhcpServerv4Scope
El objeto
Microsoft.Management.Infrastructure.CimInstance
es una clase contenedora que muestra objetos de Instrumental de administración de Windows (WMI). La ruta de acceso después del signo de número (#
) proporciona el espacio de nombres y el nombre de clase del objeto WMI subyacente.
Salidas
El tipo de resultado es el tipo de objetos que emite el cmdlet.
Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DHCP/DhcpServerv4Lease[]
El objeto
Microsoft.Management.Infrastructure.CimInstance
es una clase contenedora que muestra objetos de Instrumental de administración de Windows (WMI). La ruta de acceso después del signo de número (#
) proporciona el espacio de nombres y el nombre de clase del objeto WMI subyacente.
Ejemplos
EXAMPLE 1
This example gets all the active IPv4 address leases from the DHCPv4 scopes 10.10.10.0.
PS C:\> Get-DhcpServerv4Lease -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0
EXAMPLE 2
This example gets the IP address lease information for the IPv4 addresses 10.10.10.10 and 20.20.20.20.
PS C:\> Get-DhcpServerv4Lease -ComputerName dhcpserver.contoso.com -IPAddress 10.10.10.10,20.20.20.20
EXAMPLE 3
This example gets all the bad, or declined, IPv4 address leases from the DHCPv4 scope 10.10.10.0.
PS C:\> Get-DhcpServerv4Lease -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -BadLeases
EXAMPLE 4
This example gets the IPv4 address leases from the DHCPv4 scope 10.10.10.0 for the clients identified by the client IDs F0-DE-F1-7A-00-5E and 00-24-D7-C5-25-B0.
PS C:\> Get-DhcpServerv4Lease -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -CliendId F0-DE-F1-7A-00-5E, 00-24-D7-C5-25-B0
EXAMPLE 5
This example gets all of the types of IPv4 address leases including Active, Declined, and Expired from the DHCPv4 scope 10.10.10.0.
PS C:\> Get-DhcpServerv4Lease -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -AllLeases
EXAMPLE 6
This example gets all of the active IP address leases from all of the scopes on the DHCP server service running on the computer named dhcpserver.contoso.com. The Get-DhcpServerv4Scope cmdlet returns the scope objects and pipes the objects into this cmdlet which returns the active address lease objects from all the scopes.
PS C:\> Get-DhcpServerv4Scope -ComputerName dhcpserver.contoso.com | Get-DhcpServerv4Lease -ComputerName dhcpserver.contoso.com