Get-Weather.ps1


<#PSScriptInfo
 
.VERSION 1.0
 
.GUID 52adb798-b5d8-4b5c-b035-126b8c934636
 
.AUTHOR Musa ugurlu
 
.COMPANYNAME
 
.COPYRIGHT Musa Ugurlu - 2017
 
.TAGS
 
.LICENSEURI
 
.PROJECTURI https://gist.github.com/musaugurlu/cd2f54fe3fe61c38d374f756c47e4269
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
 
 
#>


<#
 
.DESCRIPTION
 Shows Weather information. Note: ANSI Chars need to be enabled
 
.EXAMPLE
 Get-Weather
 
.EXAMPLE
 Get-Weather -City Jacksonville
 
.EXAMPLE
 Import-Csv "CityList.csv" | Get-Weather
 
 
#>
 
Param(
    [Parameter(Mandatory=$false,ValueFromPipeline=$True)]
    [string] $City
)

if($City) {
    (Invoke-WebRequest -Uri "http://wttr.in/~$City" -UserAgent "curl").Content        
} else {
    (Invoke-WebRequest -Uri "http://wttr.in" -UserAgent "curl").Content        
}