Skip to content

Instantly share code, notes, and snippets.

@jeffbuenting
Created August 7, 2015 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffbuenting/a3846ff2a91aefeaad87 to your computer and use it in GitHub Desktop.
Save jeffbuenting/a3846ff2a91aefeaad87 to your computer and use it in GitHub Desktop.
2015 AUG Powershell SCripting Games
# ----- Single Line
invoke-restmethod -Uri "www.telize.com/geoip" | Format-Table -AutoSize -Property Longitude,Latitude,Continent_Code,Timezone
# ----- Wrapped in a function
Function Get-GEOInformation {
<#
.Description
Returns the location information from any IP.
.Parameter IP
IP to run query against. Will return the information for the IP the query is coming from.
.Example
Returns the information for one IP
Get-GEOInformation -IP 10.100.1.25
#>
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline=$True)]
[String[]]$IP = ' '
)
Process{
Foreach ( $I in $IP ) {
Write-Verbose "Getting Information for $I"
Write-Output invoke-restmethod -Uri "www.telize.com/geoip/$I"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment