Bearbeiten

Freigeben über


Find-IpamFreeAddress

Gets one or more free IP addresses from a range of IP addresses in IPAM.

Syntax

Find-IpamFreeAddress
    [-InputObject] <CimInstance>
    [[-NumAddress] <UInt32>]
    [-TestReachability]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [<CommonParameters>]

Description

The Find-IpamFreeAddress cmdlet gets one or more free IP addresses from a range of IP addresses in IP Address Management (IPAM). If you specify the NumAddress parameter, the cmdlet returns the requested number of free IPv4 addresses. If you do not specify the NumAddress parameter, the cmdlet returns a single free IP address. The maximum number of free IP addresses that the cmdlet returns is 1024. The cmdlet does not include exclusion address ranges, reservations, and assigned addresses among the free IP addresses. If the requested number of free IP addresses could not be found, a warning occurs. If you specify the TestReachability parameter, IPAM returns a ping status and a Domain Name System (DNS) record status for each of the IP address that it returns.

Examples

Example 1: Find a free IP address

PS C:\> Get-IpamRange -StartIPAddress "10.12.3.1" -EndIPAddress "10.12.3.254" | Find-IpamFreeAddress

IpAddress       : 10.12.3.1

PingStatus      : Undetected

DnsRecordStatus : Undetected

This command gets a range of IP addresses through the Get-IpamRange cmdlet then finds a free IP address. By default, IPAM does not test the reachability of the address or the existence of a corresponding DNS record.

Example 2: Find a free IP address and test the reachability of the address

PS C:\> $FreeIPs = Get-IpamRange -StartIPAddress "10.12.3.1" -EndIPAddress "10.12.3.254" | Find-IpamFreeAddress -NumAddress 10 -TestReachability
PS C:\> $FreeIPs[0]
IpAddress       : 10.12.3.1

PingStatus      : NoReply

DnsRecordStatus : NotFound

The first command uses the Get-IpamRange cmdlet to get a range of IP addresses and then uses the Find-IpamFreeAddress cmdlet to find 10 free IP addresses. The first command then checks if the IP addresses are reachable and whether there is a corresponding DNS record. The first command then stores the result in the variable named $FreeIPs.

The second command then outputs the results stored in the variable named $FreeIPs.

Parameters

-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
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.

Type:CimInstance
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-NumAddress

Specifies the number of free addresses that this cmdlet gets. The cmdlet will warn you if the number of free addresses returned is less than the number requested. If you do not specify this parameter, the cmdlet returns a single free address.

Type:UInt32
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TestReachability

Indicates that the cmdlet tests the reachability of the IP addresses.

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

Outputs

IpamFreeAddress

This cmdlet returns an object that represents an unallocated IP address in IPAM server. Along with the IP address, the object also contains flags that specify whether IPAM server was able to ping the IP address and whether IPAM server found an associated DNS record.