Parsing HTML Tables with PowerShell for BIOS Update Notifications

I wanted to get notified any time there was a new BIOS update for the motherboard that I use on one of my desktop systems, which is an ASRock Phantom Gaming 4. Unfortunately, most motherboard manufacturers have terrible websites, that are hard to navigate, so I had to improvise.

One of the specific challenges I had was that ASRock’s website had the BIOS version table of information hidden behind a button that loads dynamic content into the product page. Without doing some more advanced browser automation with Selenium or Playwright, this would’ve blocked me, but I had a solution.

Instead of letting the page load the dynamic content for me, why I don’t I just load the dynamic content directly? Where do I load this dynamic content from? I needed to find out, so I used the Google Chrome Dev Tools (CTRL + SHIFT + I or F12) to monitor the network when I clicked the “BIOS” button. It turns out that I could access a static HTML page with just the BIOS version table!

Once I retrieved the URL containing the BIOS information, I plugged that into a PowerShell script, and wrote up some regular expression code to parse out the details of each version: the version number, the date each version was published, and the download size of each BIOS package.

function Get-ASRockBIOSVersions {
    [CmdletBinding()]
    param ()
    $Uri = 'https://www.asrock.com/MB/AMD/X570%20Phantom%20Gaming%204%20WiFi%20ax/BIOS.html'
    $result = Invoke-WebRequest -Uri $Uri

    $regex = [regex]'(?<BIOSVersion>\d\.\d{2}).+(?<Date>\d{4}/\d{1,2}/\d{1,2}).+>(?<Size>.+MB)'
    $MatchList = $regex.Matches($result.Content)
    foreach ($Match in $MatchList) { 
        [PSCustomObject]@{
            BiosVersion = $Match.Groups['BIOSVersion']
            Date = $Match.Groups['Date']
            Size = $Match.Groups['Size']
        }
    }
}

Get-ASRockBIOSVersions

The net result of this PowerShell script is a simple array of PowerShell objects that shows me all of the currently available BIOS versions for the motherboard. I can detect when a new version comes out, and send myself an e-mail or text message, using some other mechanism like Amazon Simple E-mail Service (SES) or Simple Notification Service (SNS)!