< Back

Get-NetworkRange

Wed Jan 15, 2020 2:25 am

NAME Get-NetworkRange



SYNOPSIS

Get a list of IP addresses within the specified network.





SYNTAX

Get-NetworkRange [-IPAddress] <String> [[-SubnetMask] <String>] [-IncludeNetworkAndBroadcast] [<CommonParameters>]



Get-NetworkRange -Start <IPAddress> -End <IPAddress> [<CommonParameters>]





DESCRIPTION

Get-NetworkRange finds the network and broadcast address as decimal values then starts a counter between the two,

returning IPAddress for each.





PARAMETERS

-IPAddress <String>

Either a literal IP address, a network range expressed as CIDR notation, or an IP address and subnet mask in a

string.



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-SubnetMask <String>

A subnet mask as an IP address.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-IncludeNetworkAndBroadcast [<SwitchParameter>]

Include the network and broadcast addresses when generating a network address range.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Start <IPAddress>

The start address of a range.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-End <IPAddress>

The end address of a range.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String





OUTPUTS

System.Net.IPAddress





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-NetworkRange 192.168.0.0 255.255.255.0



Returns all IP addresses in the range 192.168.0.0/24.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-NetworkRange 10.0.8.0/22



Returns all IP addresses in the range 192.168.0.0 255.255.252.0.











RELATED LINKS