Get-IPAddress.ps1

by Dec 3, 2008

# Requires -Version 2.0 # Get-IPAddress.ps1 # Parses an address, returns a System.NET.IPAddress if OK # Thomas Lee – tfl@psp.co.uk $strings = " 10.1.1.100 " , " 10.1 " , " fooey " foreach ( $string in $strings ){ try { $address = [System.Net.IPAddress] :: parse( $string ) " `"{0}`" `tis a valid IP address " -f $address .IPaddressToString } catch { " `"{0}`" `tis NOT a valid IP address " -f $string… Read the full text.