Validating ip address
A quick way I found for validating that an IP Address was passed is using the [IPAddress] Type Accelerator and the parameter option of [Validate Script()] if we look at the type accelerator it self if we pass a valid IPv4 or IPv6 Address we get an IPAddress object: [ipaddress]"192.168.1.1" Address : 16885952 Address Family : Inter Network Scope Id : Is IPv6Multicast : False Is IPv6Link Local : False Is IPv6Site Local : False Is IPv6Teredo : False Is IPv4Mapped To IPv6 : False IPAddress To String : 192.168.1.1 [ipaddress]"218.104.22.168" Cannot convert value "222.214.171.124" to type "System.
With all that in mind, though, let’s take a look at how to assign static IP addresses within Windows XP, Vista, 7, 8, and 10.
In the “Network Connections” window, right-click the adapter for which you want to set a static IP address, and then select the “Properties” command.
In the properties window for the adapter, select “Internet Protocol Version 4 (TCP/IPv4)” and then click the “Properties” button.
To set a Static IP in Windows XP, right-click the “My Network Places” icon, and then select “Properties.” Right-click the adapter for which you want to set the IP, and then select “Properties” from the context menu.
Select the “Internet Protocol (TCP/IP)” entry, and then click the “Properties” button. Type in the IP address, subnet mask, default gateway, and DNS server addresses you want to use. You will need to close out of the adapter’s properties window before the changes go into effect.