Functions/Networking/Convert-IPtoInt64.ps1

function Convert-IPtoInt64
    {
    Param
    (
        # IP address to convert
        [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
        [string]
        $IPAddress
    )

    Process
    {
        $TrueIP = try{[Net.IPAddress]::Parse($IPAddress)}catch{$null}  
        if($TrueIP)
        {
            $octets = $IPAddress.split(".")  
            [int64]([int64]$octets[0]*16777216 + [int64]$octets[1]*65536 + [int64]$octets[2]*256 +[int64]$octets[3])
        }
        else {Write-Host "Could not parse IP: $IPAddress" -ForegroundColor Red}
    }
}