Created
August 7, 2015 15:08
-
-
Save jeffbuenting/a3846ff2a91aefeaad87 to your computer and use it in GitHub Desktop.
2015 AUG Powershell SCripting Games
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----- 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