<# .SYNOPSIS Counts the CVEs Microsoft lists against Windows 11 24H2 and 25H2 in one monthly security release. .DESCRIPTION Read-only. It makes one GET request to Microsoft's public Security Update Guide API (no sign-in, no key), counts, and prints one line. It changes nothing on the PC. A CVE is counted when Microsoft lists it against a product whose name contains "Windows 11 Version 24H2" or "Windows 11 Version 25H2". .PARAMETER Month The release to count, written the way Microsoft names it: four-digit year, a hyphen, and the three-letter English month. Example: 2026-Nov .EXAMPLE .\Get-PatchTuesdayCveCount.ps1 -Month 2026-Nov #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [ValidatePattern('^\d{4}-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)$')] [string]$Month ) $uri = "https://api.msrc.microsoft.com/cvrf/v3.0/cvrf/$Month" try { $doc = Invoke-RestMethod -Uri $uri -Headers @{ Accept = 'application/xml' } -ErrorAction Stop } catch { Write-Warning "Could not read $uri. $($_.Exception.Message)" exit 1 } if ($doc -isnot [System.Xml.XmlDocument]) { Write-Warning "Microsoft's answer for $Month was not the XML document this script expects. Nothing was counted." exit 1 } # Step 1: which product IDs mean Windows 11 24H2 or 25H2 in this release? $wanted = @{} foreach ($p in $doc.SelectNodes("//*[local-name()='FullProductName'][@ProductID]")) { if ($p.InnerText -match 'Windows 11 Version (24H2|25H2)') { $wanted[$p.GetAttribute('ProductID')] = $true } } if ($wanted.Count -eq 0) { Write-Warning "The $Month release lists no Windows 11 24H2 or 25H2 product. Nothing was counted." exit 1 } # Step 2: count every CVE that lists one of those products. $total = 0; $critical = 0; $exploited = 0 foreach ($v in $doc.SelectNodes("/*/*[local-name()='Vulnerability']")) { $mine = $false foreach ($n in $v.SelectNodes("*[local-name()='ProductStatuses']//*[local-name()='ProductID']")) { if ($wanted.ContainsKey($n.InnerText)) { $mine = $true; break } } if (-not $mine) { continue } $total++ # Severity and exploit status can differ per product. Prefer the lines for our products, # then lines that name no product, then any line. $found = @{ 'Severity' = @{ ours = @(); all = @(); other = @() }; 'Exploit Status' = @{ ours = @(); all = @(); other = @() } } foreach ($t in $v.SelectNodes("*[local-name()='Threats']/*[local-name()='Threat']")) { $kind = $t.GetAttribute('Type') if (-not $found.ContainsKey($kind)) { continue } $d = $t.SelectSingleNode("*[local-name()='Description']") if ($null -eq $d -or -not $d.InnerText) { continue } $products = @($t.SelectNodes("*[local-name()='ProductID']") | ForEach-Object { $_.InnerText }) if ($products.Count -eq 0) { $found[$kind].all += $d.InnerText } elseif (@($products | Where-Object { $wanted.ContainsKey($_) }).Count -gt 0) { $found[$kind].ours += $d.InnerText } else { $found[$kind].other += $d.InnerText } } $pick = @{} foreach ($kind in $found.Keys) { if ($found[$kind].ours.Count) { $pick[$kind] = $found[$kind].ours } elseif ($found[$kind].all.Count) { $pick[$kind] = $found[$kind].all } else { $pick[$kind] = $found[$kind].other } } if ($pick['Severity'] -contains 'Critical') { $critical++ } if (@($pick['Exploit Status']).Count -gt 0 -and @($pick['Exploit Status'])[0] -match '(^|;)\s*Exploited:\s*Yes') { $exploited++ } } "{0}: {1} CVEs for Windows 11 24H2 and 25H2, {2} rated Critical, {3} exploited before the fix shipped" -f $Month, $total, $critical, $exploited