functions/Invoke-VulnerabilityCheck.ps1

function Invoke-VulnerabilityCheck {   
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]
        $ReportLocation,
        [int]
        $Threshold = 0
    )
    
    begin {
        Write-Host "Begin Invoke" -Foreground yellow
        Write-Host "Report Location: $ReportLocation"
        Write-Host "Threshold: $Threshold"
    }
    
    process {
        $Report = Get-ChildItem $ReportLocation

        $Test = Test-DependencyVulnerabilities -ReportLocation $Report -Threshold $Threshold
    }
    end {
        if (!$Test) {
            Write-Error "Test Exceeded Threshold"               
        }
        Write-Host "End Invoke" -Foreground yellow
    }
}