How to Get Weather Forecast In PowerShell

Yesterday, we reviewed a nice and useful service,, which allows the user to fetch the weather forecast in Linux terminal. Today, we'll learn how to do the same in Windows PowerShell.


We will use an open source web service to fetch the weather forecast. can be used not only to check the weather, but also for some other purposes. For example, you can see the current Moon phase.

PowerShell is an advanced form of command prompt. It is extended with a huge set of ready-to-use cmdlets and comes with the ability to use .NET framework/C# in various scenarios. See All ways to open PowerShell in Windows 10.

In PowerShell, there is a special alias "curl" for the built-in cmdlet Invoke-RestMethod, which can retrieve the URL contents from the PowerShell console. This will allow us to use commands I've provided in the Linux article almost without modification.

To get the weather forecast in PowerShell, you can use the following commands.

To get the current weather in PowerShell, type or copy-paste the following command:

(curl -UserAgent "curl" ).Content

Windows 10 Weather In Powershell

You can specify the desired location as follows:

(curl -UserAgent "curl" ).Content

The output will be as follows:

Windows 10 Location Weather In Powershell

You can specify the country where you live when required. The syntax is as follows:

(curl"Madrid,Spain" -UserAgent "curl" ).Content

Double quotes are important to ensure that the location will be passed to the service, otherwise you will get an error in PowerShell.

Windows 10 Country Weather In Powershell


The service supports a number of options. Open the following page to learn about them:

Alternatively, you can use this command in your terminal:

(curl -UserAgent "curl" ).Content

Here are some useful options.

(curl  -UserAgent "curl" ).Content

This will display the short version of the forecast which includes only Noon and Night.

(curl -UserAgent "curl" ).Content

This will show only the current weather in the specified location.

Windows 10 Short Weather Forecast In PowerShell

It is worth mentioning that the service can show the forecast right in your web browser. Point your browser to the same location you use in PowerShell. See the following screenshot:

Windows 10 Weather In Edge

If you add ".png" to the location, the service will return a PNG image. You can embed it in your web page.
For example, open this link:

Windows 10 Png Weather In Edge

When in PNG mode, you can pass parameters as follows:

For example:

The service is localized into several languages.
To change the forecast language, you can use the following syntax:

(curl -UserAgent "curl" ).Content
(curl -UserAgent "curl" ).Content

Windows 10 Weather In PowerShell Translated To Russian

Alternatively, you can use subdomains as follows:

(curl -UserAgent "curl" ).Content

(curl -UserAgent "curl" ).Content

Windows 10 Weather In PowerShell Translated To German

Supported languages are:

az bg ca cs cy da de el eo es fi fr hi hr hu is it ja ko mk ml nl nn pt pl ro ru sk sl sr sr-lat sv tr uk uz vi zh et hy jv ka kk ky lt lv sw th zu bs be can be used to see the current Moon phase. Execute the following command:

(curl -UserAgent "curl" ).Content

Windows 10 Moon Phase In PowerShell

Note: All screenshots above were made in Windows 10 Creators Update. In previous Windows versions, there can be an issue with ANSI sequences in PowerShell. If you are running Windows 7 or Windows 8, please refer to the following page to get a workaround: How to enable in a PowerShell console.

That's it.


Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:


13 thoughts on “How to Get Weather Forecast In PowerShell

  1. Shyam

    Excellent again! More useful now as I am on Windows. :) Thanks Sergey!

    1. Sergey Tkachenko Post author

      You are welcome. :-)

  2. jupe

    Thanks for another informative article, I received an error and realized I had to add -UseBasicParsing to the command which I think is because I uninstalled IE11 if anyone else gets an error the following worked for me.

    (curl -UseBasicParsing -UserAgent “curl” ).Content

  3. cents

    Thats pretty cool.

  4. Phil

    How do i get workaround for win7?

    1. Sergey Tkachenko Post author

      Use the sample script provided by the author. Save as a PS1 file and run.

      1. Phil

        it gives me error

        1. Sergey Tkachenko Post author

          Can you show me the whole script?

          1. Phil

            It might slow download speed
            sha256sum: 46371BD8C52150EAAACB9F4F30218AC74AA6044B6B458934B355357DB5263CB3

  5. Alicia

    it doesn’t work in windows 7

    1. Sergey Tkachenko Post author

      Even after the mentioned workaround?

      1. Alicia

        how do I workaround on windows 7 with powershell script?

        1. Sergey Tkachenko Post author

          save it as a ps1 file and run.


Leave a Reply

Your email address will not be published. Required fields are marked *