Skip to content

Instantly share code, notes, and snippets.

@AdamDempsey
Created February 4, 2022 11:44
Show Gist options
  • Save AdamDempsey/fc2f6daf7d93c549c9527702088013d8 to your computer and use it in GitHub Desktop.
Save AdamDempsey/fc2f6daf7d93c549c9527702088013d8 to your computer and use it in GitHub Desktop.
Windows Server 2019 - Latest Build Numbers
$request = Invoke-WebRequest "https://support.microsoft.com/en-gb/help/4464619" –UseBasicParsing
If ($request.StatusCode -eq 200) {
$Matches = [regex]::Matches($request.Content, 'href="([a-z0-9-\/]*)">([a-zA-Z]*) ([0-9]{1,2}), ([0-9]{4}).*?(KB[0-9]*) \(OS Build 17763.([0-9]*)\)(?: ([a-zA-Z-]*)<\/a>)?')
if ($Matches.Count -gt 0) {
$LatestServer2019Raw = [PSCustomObject]@{
'OS build' = $Matches[0].Groups[6].Value
'Date' = "$($Matches[0].Groups[3].Value) $($Matches[0].Groups[2].Value) $($Matches[0].Groups[4].Value)"
'URL' = "https://support.microsoft.com$($Matches[0].Groups[1].Value)"
'KB' = $Matches[0].Groups[5].Value
'Info' = $Matches[0].Groups[7].Value
}
$PreviousServer2019Raw = [PSCustomObject]@{
'OS build' = $($Matches[1].Groups[6].Value)
'Date' = "$($Matches[1].Groups[3].Value) $($Matches[1].Groups[2].Value) $($Matches[1].Groups[4].Value)"
'URL' = "https://support.microsoft.com$($Matches[1].Groups[1].Value)"
'KB' = $Matches[1].Groups[5].Value
'Info' = $Matches[1].Groups[7].Value
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment