HI,

Sometime we need to know the static/Public IP address of our internet connections. You may need to incoprate a static ip adress of the user in to some script output. You may be you want to show static IP in some of your in-house WPF PowerShell based GUIs.

In my scenerio i need to in-coprorate the static ip of internet user in to some client based reporting scripts, to achieve that i have written this simple script in powershell.

I hope that you may like this script and this script may help you .

For more info visit this link http://newdelhipowershellusergroup.blogspot.in/2012/10/powershell-script-to-get-static-ip.html

 

Best Regards!

Aman Dhally 

Come and join my journey of 100 Days of Self Improvement programme: https://www.facebook.com/100DoSI or at www.amandhally.net   

MY PowerShell Blog : http://newdelhipowershellusergroup.blogspot.com/ 

MY Personal Website: www.amandhally.net

 

Screenshot of the script.

 

PowerShell
Edit|Remove
<# 
            " Satnaam WaheGuru Ji"     
             
            Author  :  Aman Dhally 
            E-Mail  :  amandhally@gmail.com 
            website :  www.amandhally.net 
            twitter : https://twitter.com/#!/AmanDhally 
            facebook: http://www.facebook.com/groups/254997707860848/ 
            Linkedin: http://www.linkedin.com/profile/view?id=23651495 
 
            Date    : 03-Oct-2012 
            File    : static-Ip 
            Purpose : Get Static Ip adress of the Internet 
             
            Version : 1 
 
            my Spider runned Away :(  
 
 
#> 
 
#Variables 
    # I am defining website url in a variable 
    $url = "http://checkip.dyndns.com"  
    # Creating a new .Net Object names a System.Net.Webclient 
    $webclient = New-Object System.Net.WebClient 
    # In this new webdownlader object we are telling $webclient to download the 
    # url $url  
    $Ip = $webclient.DownloadString($url) 
    # Just a simple text manuplation to get the ipadress form downloaded URL 
    # If you want to know what it contain try to see the variable $Ip 
    $Ip2 = $Ip.ToString() 
    $ip3 = $Ip2.Split(" ") 
    $ip4 = $ip3[5] 
    $ip5 = $ip4.replace("</body>","") 
    $FinalIPAddress = $ip5.replace("</html>","") 
 
#Write Ip Addres to the console 
    $FinalIPAddress 
 
### end of the script..... 
################################|-Aman Dhally - |-#############################