Advertisement
Guest User

PowerShell Get-MyExternalIp (does what it says)

a guest
May 22nd, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #written by pan_2.livejournal.com
  2. #get external ip address using 2ip.ru service
  3.  
  4. function Get-MyExternalIp
  5.  
  6. {
  7. $client = New-Object system.net.webclient
  8. $text = $client.DownloadString("http://2ip.ru")
  9. $AllMatches = [regex]::matches($text,'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
  10. $AllMatches[0].Value
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement