Skip to content

Instantly share code, notes, and snippets.

@rvrsh3ll
Created January 15, 2019 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvrsh3ll/ef414159b47491bd8a3dc4e2c18ffe6c to your computer and use it in GitHub Desktop.
Save rvrsh3ll/ef414159b47491bd8a3dc4e2c18ffe6c to your computer and use it in GitHub Desktop.
Function Get-CidrHostCount {
[CmdletBinding()]
Param (
[Parameter(Mandatory)]
[ValidateRange(1,32)]
$Cidr
)
Begin {
} # End Begin.
Process {
"Number of hosts for /$Cidr`: $('{0:N0}' -f [System.Math]::Pow(2,32-$Cidr))"
} # End Process.
End {
} # End End.
} # End Function: Get-CidrHostCount.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment