Exporting WSUS data to Excel

In addition to generating update reports in PowerShell, the results can also be exported into Excel or other tools. By exporting the update or inventory reports to Excel, we can use a familiar tool to view, filter, and display the information in ways that are useful to us.

Getting ready

In this recipe, we will be using the process in the prior recipe to query the update server database. We will then return the resulting dataset and export it into a format that Excel can utilize.

How to do it...

Carry out the following steps to export WSUS data to Excel:

  1. Create the dataset object. This is the same process as the Creating an update report recipe.
  2. Export the dataset to an XML file:
    $ds.Tables[0].WriteXml("C:\temp\inventory.xml") ...

Get Windows Server 2012 Automation with PowerShell Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.