Read a Web Page from PowerShell, Make a Web Page from a Database Query From PowerShell

I presented at the Pacific Northwest SQL Server User Group here in the Seattle area last night, and I was asked at the break about reading a web page in PowerShell, and being able to do something with the data it has. There are actually a few ways to do that, but you should probably start with the net.webclient call - there's a quick overview of that here: and more info on it here:

Once you have the web page object, you'll need to parse it using string methods to find the data you want to get, store those as variables, and then use standard database insert calls to put the data back. Here's an article on inserting data, and there are others as well: 

You can also hit a web service even easier, and then store the results directly into a variable: 

And I've written an article that shows how to go the other way and make a simple web page by using PowerShell to extract data from a database. You can find that here:

Skip to main content