< Back

Get-Subnet

Wed Jan 15, 2020 2:27 am

NAME Get-Subnet



SYNOPSIS

Get a list of subnets of a given size within a defined supernet.





SYNTAX

Get-Subnet [-IPAddress] <String> [[-SubnetMask] <String>] -NewSubnetMask <String> [<CommonParameters>]





DESCRIPTION

Generates a list of subnets for a given network range using either the address class or a user-specified value.





PARAMETERS

-IPAddress <String>

Any address in the super-net range. 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? false

Accept wildcard characters? false



-SubnetMask <String>

The subnet mask of the network to split. Mandatory if the subnet mask is not included in the IPAddress

parameter.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NewSubnetMask <String>

Split the existing network described by the IPAddress and subnet mask using this mask.



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



OUTPUTS

Indented.Net.IP.Subnet





NOTES





Change log:

07/03/2016 - Chris Dent - Cleaned up code, added tests.

12/12/2015 - Chris Dent - Redesigned.

13/10/2011 - Chris Dent - Created.



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



PS C:\\>Get-Subnet 10.0.0.0 255.255.255.0 -NewSubnetMask 255.255.255.192



Four /26 networks are returned.









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



PS C:\\>Get-Subnet 0/22 -NewSubnetMask 24



64 /24 networks are returned.











RELATED LINKS