Wednesday, January 4, 2012

Powershell - Function: Get-WanIP

To help fill a spot for a Powershell script request on Technet, I found this link:
http://msgroups.net/microsoft.public.windows.powershell/Get-WanIP
After exploring the snippets a little I came up with this thanks to Larry Weiss.
<#
.AUTHOR
Will Steele (wlsteele@gmail.com)

.DEPENDENCIES
Internet access is required.

.DESCRIPTION
This script processes returns the WAN IP of one's machine.

.EXAMPLE
None.

.EXTERNALHELP
None.

.FORWARDHELPTARGETNAME
None.

.INPUTS
None.

.LINK
http://msgroups.net/microsoft.public.windows.powershell/Get-WanIP.

.NAME
Get-WanIP

.NOTES
This script was originally provided by Larry Weiss in the powershell msgroups page.

.OUTPUTS
System.Object

.PARAMETER n/a

.SYNOPSIS
Get WAN IP.
#>

# Create a new instance of WebClient and download string.
(New-Object System.Net.WebClient).DownloadString("http://automation.whatismyip.com/n09230945.asp")
The script can be downloaded from:
http://gallery.technet.microsoft.com/scriptcenter/Get-WanIP-b0ca5cb3 

0 comments:

Post a Comment