functions/Mde/vulnerabilities/Get-MdVulnerability.ps1
function Get-MdVulnerability { <# .SYNOPSIS Retrieves a list of all the vulnerabilities. .DESCRIPTION Retrieves a list of all the vulnerabilities. Scopes required (delegate auth): Vulnerability.Read .PARAMETER VulnerabilityID ID of the vulnerability to retrieve. .EXAMPLE PS C:\> Get-MdVulnerability Retrieves a list of all the vulnerabilities. .EXAMPLE PS C:\> Get-MdVulnerability -VulnerabilityID $vulnerabilityid <insert description here> .LINK https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/get-all-vulnerabilities?view=o365-worldwide #> [CmdletBinding(DefaultParameterSetName = 'default')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'GetVulnerability')] [Alias('Id')] [string] $VulnerabilityID ) 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 = 'vulnerabilities' Method = 'get' RequiredScopes = 'Vulnerability.Read' } if ($VulnerabilityID) { $__param.Path += "/$VulnerabilityID" } $__param += $PSBoundParameters | ConvertTo-HashTable -Include 'ErrorAction', 'WarningAction', 'Verbose' try { Invoke-DefenderAPIRequest @__param } catch { $PSCmdlet.ThrowTerminatingError($_) } } } |