functions/Mde/machines/Get-MdMachineVulnerability.ps1
function Get-MdMachineVulnerability { <# .SYNOPSIS Retrieves a collection of discovered vulnerabilities related to a given device ID. .DESCRIPTION Retrieves a collection of discovered vulnerabilities related to a given device ID. Scopes required (delegate auth): Vulnerability.Read .PARAMETER MachineID ID of the machine to read the detected vulnerabilities from. .EXAMPLE PS C:\> Get-MdMachineVulnerability -MachineID $machineid <insert description here> .LINK https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/get-discovered-vulnerabilities?view=o365-worldwide #> [CmdletBinding(DefaultParameterSetName = 'default')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'default')] [Alias('Id')] [string] $MachineID ) process { $__mapping = @{ } $__param = @{ Body = $PSBoundParameters | ConvertTo-HashTable -Include @() -Mapping $__mapping Query = $PSBoundParameters | ConvertTo-HashTable -Include @() -Mapping $__mapping Header = $PSBoundParameters | ConvertTo-HashTable -Include @() -Mapping $__mapping Path = 'machines/{MachineID}/vulnerabilities' -Replace '{MachineID}',$MachineID Method = 'get' RequiredScopes = 'Vulnerability.Read' Service = 'DefenderAPI.Endpoint' } $__param += $PSBoundParameters | ConvertTo-HashTable -Include 'ErrorAction', 'WarningAction', 'Verbose' try { Invoke-EntraRequest @__param } catch { $PSCmdlet.ThrowTerminatingError($_) } } } |