Public/Get-MpDetections.ps1
function Get-MpDetections { <# .SYNOPSIS Gets Windows Defender detected threats. .DESCRIPTION Returns a list of threats that have been detected by Windows Defender. .EXAMPLE Get-MpDetections .OUTPUTS System.Object[] #> [CmdletBinding()] param() try { # Initialize the MP threats data $initResult = Initialize-MPThreats if (-not $initResult) { Write-Error "Failed to initialize threat data" return $null } # Return the detected threats return $Script:mpdetected } catch { Write-Error "An error occurred while getting MP detections: $_" return $null } } |