PoshCode Archive  Artifact [139b2e51aa]

Artifact 139b2e51aa853de2b19a4c4011820b3262282f04c0c18e043e6dc219a94d0553:

  • File Get-MyPublicIPAddress.ps1 — part of check-in [45b50c1d72] at 2018-06-10 13:13:53 on branch trunk — The Get-MyPublicIPAddress script uses DNS-O-Matic, an OpenDNS resource, to retreive the public IP address that represents your computer on the internet. (user: Rich Kusak size: 1339)

# encoding: ascii
# api: powershell
# title: Get-MyPublicIPAddress
# description: The Get-MyPublicIPAddress script uses DNS-O-Matic, an OpenDNS resource, to retreive the public IP address that represents your computer on the internet.
# version: 1.0.0.0
# type: script
# author: Rich Kusak
# license: CC0
# x-poshcode-id: 2661
# x-archived: 2012-12-29T04:07:36
# x-published: 2012-05-06T12:09:00
#
#
<# 
	.SYNOPSIS
		Gets the public IP address that represents your computer on the internet.
	
	.DESCRIPTION
		The Get-MyPublicIPAddress script uses DNS-O-Matic, an OpenDNS resource, to retreive the public IP address that represents your computer on the internet.
	
	.EXAMPLE
		Get-MyPublicIPAddress
		1.1.1.1
		
		Description
		-----------
		This command returns the public IP address that represents your computer on the internet.
	
	.INPUTS
		None
	
	.OUTPUTS
		System.String
	
	.NOTES
		Name: Get-MyPublicIPAddress
		Author: Rich Kusak
		Created: 2010-08-30
		LastEdit: 2010-08-30 11:05
		Version: 1.0.0.0
		
	.LINK
		http://myip.dnsomatic.com

	.LINK
		http://www.opendns.com	
#>

	[CmdletBinding()]
	param ()
	
	# Create a web client object
	$webClient = New-Object System.Net.WebClient
	
	# Returns the public IP address
	$webClient.DownloadString('http://myip.dnsomatic.com/')