11-27-2008
Downloads: 342
File size: 220 B
Views: 1,534
Embed
 |
Identify Host Name Type |
- function Check-Hostname($name) {
- [System.Uri]::CheckHostName($name)
- }
-
- Check-Hostname "127.0.0.1"
- Check-Hostname "2001:0:d5c7:a2ca:89e:7bd:a865:5eb6"
- Check-Hostname "www.powershell.com"
- Check-Hostname "///"
The Function Check-Hostname provides a simple wrapper around the CheckHostName() static method found in System.URI. With it, you can check host names and find out their type. For example, you can distinguish valid DNS names, IPv4- and IPv6 IP addresses.