Get-MyInternetIP and Get-MyInternetCity

image

 

Two very simple function that’s get my IP address and City on the internet.

Function Get-MyInternetIP {
if ($WebClient -eq $null) {$Global:WebClient=new-object System.Net.WebClient  }
$url="http://ip-address.domaintools.com/myip.xml"
$myInternetIP=([xml]($WebClient.DownloadString($url))).dnstools.ip_address
$myInternetIP
}

Function Get-MyInternetCity {
if ($WebClient -eq $null) {$Global:WebClient=new-object System.Net.WebClient  }
$url="http://ip-address.domaintools.com/myip.xml"
$myInternetCity=([xml]($WebClient.DownloadString($url))).dnstools.city
$myInternetCity
}

No related posts.

This entry was posted in PowerShell Blogs and tagged , , , , . Bookmark the permalink.

0 Responses to Get-MyInternetIP and Get-MyInternetCity

  1. nem says:

    RT – XML Goodness @walle75 2 of my #PowerShell functions, Get-MyInternetIP and Get-MyInternetCity, http://tinyurl.com/nstuf8

  2. Fredrik Wall says:

    2 of my #PowerShell functions, Get-MyInternetIP and Get-MyInternetCity, http://tinyurl.com/nstuf8

  3. nem says:

    RT @walle752 of my #PowerShell functions, Get-MyInternetIP and Get-MyInternetCity, http://tinyurl.com/nstuf8

  4. Jeffrey Snover says:

    Sweet!

    jps

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>