Skip to content

Instantly share code, notes, and snippets.

@nathanmcnulty
Last active October 10, 2021 05:30
Show Gist options
  • Save nathanmcnulty/d7b73eb7d988971af749927f5b284de3 to your computer and use it in GitHub Desktop.
Save nathanmcnulty/d7b73eb7d988971af749927f5b284de3 to your computer and use it in GitHub Desktop.
Gets a list of fully qualified Rockwell updates and stores them in $results
[array]$results = "Recommendation,CPR,OS,KB,URL"
(Invoke-WebRequest -Uri "https://www.rockwellautomation.com/ms-patch-qualification/Tabs3_new.htm").links.href | ForEach-Object {
$response = Invoke-WebRequest -Uri "https://www.rockwellautomation.com/$_"
[array]$content = $response.ParsedHtml.body.innerHTML -split "`r`n" | Where-Object { $_ -match '<TD class' } | ForEach-Object { $_.Split('<>')[2..3] } | Where-Object { $_ -ne "" }
$content | ForEach-Object {
if ($_ -eq "Fully Qualified") { $fq = $true }
if ($fq) {
if ($_ -like "SR*") { $sr = $_}
if ($_ -in "2012R2","Win8_1x64","2016","Win10","2019","Win10_20H2") { $os = $_}
if ($_ -like "*support.microsoft.com*") { $url = $_.Split('"')[1] }
if ($url) {
$kb = $url.Split('/')[-1]
$results += "Fully Qualified,$sr,$os,$kb,$url"
"fq","sr","url","kb" | ForEach-Object { Remove-Variable $_ }
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment