< Back

ConvertTo-MaskLength

Wed Jan 15, 2020 2:23 am

NAME ConvertTo-MaskLength



SYNOPSIS

Convert a dotted-decimal subnet mask to a mask length.





SYNTAX

ConvertTo-MaskLength [-SubnetMask] <IPAddress> [<CommonParameters>]





DESCRIPTION

A count of the number of 1's in a binary string.





PARAMETERS

-SubnetMask <IPAddress>

A subnet mask to convert into length.



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue)

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.Net.IPAddress





OUTPUTS

System.Int32





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



PS C:\\>ConvertTo-MaskLength 255.255.255.0



Returns 24, the length of the mask in bits.











RELATED LINKS