backlog/Test-CmBootImages.ps1

function Test-CmBootImages {
    [CmdletBinding()]
    param (
        [parameter()][string] $TestName = "Verify Boot Image OS Versions",
        [parameter()][string] $TestGroup = "configuration",
        [parameter()][string] $Description = "Check if Boot Images are supported OS versions",
        [parameter()][hashtable] $ScriptParams
    )
    try {
        $startTime = (Get-Date)
        #[int]$Setting = Get-CmHealthDefaultValue -KeySet "keygroup:keyname" -DataSet $CmHealthConfig
        [System.Collections.Generic.List[PSObject]]$tempdata = @() # for detailed test output to return if needed
        $stat   = "PASS" # do not change this
        $except = "WARNING" # or "FAIL"
        $msg    = "No issues found" # do not change this either
        $query = "SELECT
PackageID,Name,Version,case
when (left(Version,10) = '10.0.17134') then '1803'
when (left(Version,10) = '10.0.17763') then '1809'
when (left(Version,10) = '10.0.18362') then '1903'
when (left(Version,10) = '10.0.18363') then '1909'
when (left(Version,10) = '10.0.19041') then '2004'
when (left(Version,10) = '10.0.19042') then '20H2'
else '' end as BuildNumber,
Description,
PkgSourcePath,
SourceDate,
LastRefreshTime
FROM v_BootImagePackage"

        $res = Get-CmSqlQueryResult -Query $query -Params $ScriptParams
        if ($null -ne $res -and $res.Count -gt 0) {
            $stat = $except
            $msg  = "$($res.Count) items found"
            $res | Foreach-Object {
                $tempdata.Add(
                    [pscustomobject]@{
                        Name        = $_.Name
                        PackageID   = $_.PackageID
                        Version     = $_.Version
                        BuildNumber = $_.BuildNumber
                        Description = $_.Description
                        SourcePath  = $_.PkgSourcePath
                    }
                )
            }
        }
    }
    catch {
        $stat = 'ERROR'
        $msg = $_.Exception.Message -join ';'
    }
    finally {
        Write-Output $([pscustomobject]@{
            TestName    = $TestName
            TestGroup   = $TestGroup
            TestData    = $tempdata
            Description = $Description
            Status      = $stat
            Message     = $msg
            RunTime     = $(Get-RunTime -BaseTime $startTime)
            Credential  = $(if($ScriptParams.Credential){$($ScriptParams.Credential).UserName} else { $env:USERNAME })
        })
    }
}