Skip to content

Instantly share code, notes, and snippets.

[cmdletbinding(DefaultParameterSetName='Default')]
param
(
[Parameter(ParameterSetName = 'Default',
Mandatory=$true,
Position = 0)]
[String[]]$Word,
[Parameter(ParameterSetName = 'Default',
Position = 1)]
# Oneliner:
Invoke-RestMethod -Uri http://telize.com/geoip | Select-Object -Property longitude, latitude, continent_code, timezone
# Advanced function:
Function Get-GeoInformation
{
<#
.Synopsis
Get geo information for current IP address or
any specified IP address.
@SimonWahlin
SimonWahlin / gist:3c69d10a1c13aa439063
Created January 16, 2015 20:14
Contraproff empty pipelines
Function Init {
$File = "$env:tmp\testfile.tmp"
if(-Not (Test-Path -Path $File)){[Void](New-Item -Path $File -Type File)}
Start-Service -Name Spooler
}
Function Validate {
$File = "$env:tmp\testfile.tmp"
$FileStatus = if(Test-Path -Path $File){'Exists'}else{'Removed'}
$SrvStatus = (Get-Service -Name Spooler).Status