PowerShell stuff: Validating an IP address - Revisited
April 26, 2010
posted by James Kehr
Every once in a while I write these huge blocks of code to do something really cool only to find out .NET has already got that built in. Take my post from yonder days about validating an IP address…
It turns out .NET has already got that built in and all those lines of code can be condensed into this:
$ipAddress = “192.168.1.100”
$ipObj = [System.Net.IPAddress]::parse($ipAddress)
$isValidIP = [System.Net.IPAddress]::tryparse([string]$ipAddress, [ref]$ipObj)
if ($isValidIP) {
Write-host “$ipAddress is valid”
} else {
Write-host “$ipAddress is not valid”
}
http://msdn.microsoft.com/en-us/library/system.net.ipaddress.aspx
http://msdn.microsoft.com/en-us/library/system.net.ipaddress.tryparse.aspx
http://msdn.microsoft.com/en-us/library/system.net.ipaddress.parse.aspx
Get-Member $OrcsWeb | ?{$_.title -eq "System Administrator"`
-and $_.certification -contains 'MCITP:SA 2008, MCSE 2000, MCDST, Network+, A+'}
New-Variable -name company -value 'ORCS Web, Inc.' -description ‘www.orcsweb.com | 1.888.313.9421’












