Get-Weather report using Powershell


I came across some fun stuff on the internet, so I wrapped it inside a Powershell Function for this blog post.

The idea is to get weather report in Powershell console using this  cURL implementation converted into Powershell function below

Just pass a name of the City as a parameter to the Function to get the weather report of the day.

a

You can pass values through the pipeline as well.

b

Use ‘-Tomorrow‘ and ‘-DayAfterTomorrow‘ to check the weather of later than today.

c

To add this script to your Powershell profile run the below piece of code and you are good to go

Hope you’ll find the script fun and Thanks for reading.

Don’t forget to follow me on twitter for more Interesting PowerShell material and to Showoff your Powershell-Weather skills to your colleagues, Cheers! 😉

signature

Advertisements

10 thoughts on “Get-Weather report using Powershell

  1. I have no formatting and it looks messy

    PS C:\> Get-Weather Paris
    Weather report: Paris, France

    ←[38;5;240;1m .-. ←[0m Light Rain With Thunderstorm
    ←[38;5;240;1m ( ). ←[0m ←[38;5;154m17←[0m °C←[0m
    ←[38;5;240;1m (___(__) ←[0m ←[1m?←[0m ←[38;5;154m9←[0m km/h←[0m
    ←[38;5;21;1m ”←[38;5;228;5m?←[38;5;21;25m”←[38;5;228;5m?←[38;5;21;25m” ←[0m 10 km←[0m
    ←[38;5;21;1m ””←[38;5;228;5m?←[38;5;21;25m”’ ←[0m 0.2 mm←[0m
    ┌─────────────┐

    ┌──────────────────────────────┬───────────────────────┤ Fri 25 Aug ├───────────────────────┬──────────────────────────
    ────┐
    │ Morning │ Noon └──────┬──────┘ Evening │ Night

    ├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────
    ────┤
    │ ←[38;5;226m _`/””←[38;5;250m.-. ←[0m Patchy rain po│ ←[38;5;226m \ /←[0m Partly cloudy │ ←[38;5;226m _`/”
    “←[38;5;250m.-. ←[0m Patchy rain po│ ←[38;5;226m _`/””←[38;5;250m.-. ←[0m Light rain sho│
    │ ←[38;5;226m ,\_←[38;5;250m( ). ←[0m ←[38;5;226m24←[0m °C←[0m │ ←[38;5;226m _ /””←[38;5;250m.-. ←[0m ←[
    38;5;220m27←[0m-←[38;5;214m28←[0m °C←[0m │ ←[38;5;226m ,\_←[38;5;250m( ). ←[0m ←[38;5;220m27←[0m-←[38;5;214m28
    ←[0m °C←[0m │ ←[38;5;226m ,\_←[38;5;250m( ). ←[0m ←[38;5;226m24←[0m-←[38;5;220m26←[0m °C←[0m │
    │ ←[38;5;226m /←[38;5;250m(___(__) ←[0m ←[1m?←[0m ←[38;5;190m10←[0m-←[38;5;190m12←[0m km/h←[0m │ ←[38;5;226m \_←[3
    8;5;250m( ). ←[0m ←[1m?←[0m ←[38;5;190m10←[0m-←[38;5;190m11←[0m km/h←[0m │ ←[38;5;226m /←[38;5;250m(___(__) ←[0m
    ←[1m?←[0m ←[38;5;118m6←[0m-←[38;5;154m8←[0m km/h←[0m │ ←[38;5;226m /←[38;5;250m(___(__) ←[0m ←[1m↓←[0m ←[38;5;154m
    9←[0m-←[38;5;190m11←[0m km/h←[0m │
    │ ←[38;5;111m ‘ ‘ ‘ ‘ ←[0m 16 km←[0m │ ←[38;5;226m /←[38;5;250m(___(__) ←[0m 16 km←[0m │ ←[38;5;
    111m ‘ ‘ ‘ ‘ ←[0m 19 km←[0m │ ←[38;5;111m ‘ ‘ ‘ ‘ ←[0m 19 km←[0m │
    │ ←[38;5;111m ‘ ‘ ‘ ‘ ←[0m 0.1 mm | 42%←[0m │ 0.1 mm | 26%←[0m │ ←[38;5;111m ‘ ‘ ‘ ‘ ←[0m 0.6
    mm | 42%←[0m │ ←[38;5;111m ‘ ‘ ‘ ‘ ←[0m 0.3 mm | 35%←[0m │
    └──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────
    ────┘

    Like

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s