Fun: Get Weather information in PowerShell

Found these helpful sites ( and and wrote an script to get and display weather information of your current location. Now in a shell, I can check weather information too. 🙂

 Script: Get-Weather.ps1
 Description: This script will
     * Get current location
     * Find the Weather info
     * Display the weather info

 Fun fact: This command will display the GPS location

 Invoke-RestMethod -URI "" -Method GET | Select  City,Region,Country,loc | FT -auto


#Get current location (city)
$City = (Invoke-RestMethod -URI "" -Method GET).City

#get Weather info
$weather = Invoke-WebRequest -Uri "$City"
$WeatherInfo = $weather.ParsedHtml.body.outerText

#Display the weather info

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s