Weather WebService in Powershell

Did you know how easy it is to test a web service in Powershell? I think I can get used to this new tool.

Proof of concept

Here’s my script for checking the weather in powershell:

$uri = "" 
$WeatherForecast = New-WebServiceProxy -uri $uri -UseDefaultCredential -namespace "WeatherForecast" 


This publicly available web service returns the lat, lon of a zip! Sweet. I can find other uses for that.


The details object returns the forecast for today and the next 5 days.

Get the Methods

To reuse, substitute your web service’s WSDL URI and use something like the following to check for existing methods available:

$WeatherForecast | get-member -type method


I got inspiration and code pieces from, Technet’s New-WebServiceProxy reference and a blog post by Keith Hill.

  1. So it dynamically creates a web proxy from a published WSDL? Is this a SOAP web service or REST based? Is it returning JSON or XML? Can it do WS*?

  2. Yes, the proxy is created automatically. The example script calls a SOAP based web service which is most likely for a WSDL. REST doesn’t really do WSDL but I’d love to see a REST example that was this simple. JSON is XML, but I’m not sure if this example service uses it.
    Thanks for the comment!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.