I’ve shown how to get the latest release note in the previous blog post
I’ll now show what can be done with the main “Security Updates” dashboard without the API key available on this page: Security Update Guide > Dashboard
I’ve published two functions: a private one named Get-MSRCDashBoardPage and a public one named Get-MSRCDashBoard
The first private function Get-MSRCDashBoardPage aims at downloading a specific dashboard page based on a time frame. By default, without giving parameters, if there are data published based on the current date, the function gets the first page. There are 3 parameters that can be passed to the function to get another page number and specify another After and Before date. It’s a private function because it’s used by its public counterpart where it’s called recursively for every page found in a specified time range.
As you can see, we get many properties back, much more than what’s displayed by the web interface. 🙄
The second public function Get-MSRCDashBoard aims at doing the same thing as its private counterpart. The difference is that there isn’t a “Page” parameter. It downloads the first page based on the time range specified, it then gets the total number of pages available and calls recursively its private counterpart to download each page.
Now, let’s see this function in action with some examples:
- Here’s how to get all the pages on the Dashboard published in January 2018:
Get-MSRCDashBoard -After 01/01/2018 -Before 01/31/2018
- Here’s how to export to CSV all the dashboard data about security updates published this month (after the second Tuesday)
# Save every page to a CSV file Get-MSRCDashBoard | Export-Csv -Path ~/Documents/MSRCDashBoard.$((Get-Date).ToString('yyyy-MM')).csv # Read the CSV and use Out-GridView to look and filter data Import-CSV ~/Documents/MSRCDashBoard.$((Get-Date).ToString('yyyy-MM')).csv | Out-GridView
The first command saves every page to a CSV file and the second one reads the CSV file and sends the data to Out-GridView so that you can look and filter data.
- Here’s how you can display the same properties as the web interface for February 2018:
Get-MSRCDashBoard -After 02/01/2018 -Before 02/28/2018 | Select publishedDate,cveNumber,Name,Platform,articleTitle1, downloadTitle1,articleTitle2,downloadTitle2,severity,impact | Out-Gridview
- Here’s how you can display the same properties as the web interface for this month:
Get-MSRCDashBoard | Select publishedDate,cveNumber,Name,Platform,articleTitle1, downloadTitle1,articleTitle2,downloadTitle2,severity,impact | Out-Gridview
Let’s compare the Out-Gridview and the web interface:
PS: The two functions work in PowerShell Core but the “Out-Gridview” cmdlet used in examples isn’t available in PowerShell Core.