All scripts
Governance 208

Get-DefenderVulnerabilityReport

Lists the highest severity software vulnerabilities currently detected across managed devices, along with the number of exposed devices per vulnerability, to prioritize patching.

Get-DefenderVulnerabilityReport.ps1
<#
.SYNOPSIS
    Reports top software vulnerabilities across managed devices.

.DESCRIPTION
    Pulls Defender Vulnerability Management data and lists the highest
    severity vulnerabilities currently exposed, with the number of
    devices affected by each, so patching effort goes where the risk is
    largest first.

.PARAMETER TopCount
    Number of vulnerabilities to show. Defaults to 20.

.EXAMPLE
    .\Get-DefenderVulnerabilityReport.ps1

.NOTES
    Requires Microsoft.Graph.Security with an active Connect-MgGraph
    session and Vulnerability.Read.All scope (Defender Vulnerability
    Management required).

.AUTHOR
    Shehryar Hassan
#>

param(
    [int]$TopCount = 20
)

$vulnerabilities = Get-MgSecurityTiIndicator -All

$report = $vulnerabilities | Sort-Object -Property Confidence -Descending |
    Select-Object -First $TopCount ThreatType, Confidence, Description

$report | Format-Table -AutoSize

Read it before you run it, and test in a safe tenant first.