< Back

ConvertTo-Subnet

Wed Jan 15, 2020 2:23 am

NAME ConvertTo-Subnet



SYNOPSIS

Convert a start and end IP address to the closest matching subnet.





SYNTAX

ConvertTo-Subnet [-IPAddress] <String> [[-SubnetMask] <String>] [<CommonParameters>]



ConvertTo-Subnet -Start <IPAddress> -End <IPAddress> [<CommonParameters>]





DESCRIPTION

ConvertTo-Subnet attempts to convert a starting and ending IP address from a range to the closest subnet.





PARAMETERS

-IPAddress <String>

Any IP address in the subnet.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SubnetMask <String>

A subnet mask.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Start <IPAddress>

The first IP address from a range.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-End <IPAddress>

The last IP address from 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



OUTPUTS

Indented.Net.IP.Subnet





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



PS C:\\>ConvertTo-Subnet -Start 0.0.0.0 -End 255.255.255.255













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



PS C:\\>ConvertTo-Subnet -Start 192.168.0.1 -End 192.168.0.129













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>ConvertTo-Subnet 10.0.0.23/24













-------------------------- EXAMPLE 4 --------------------------



PS C:\\>ConvertTo-Subnet 10.0.0.23 255.255.255.0















RELATED LINKS