Public/Test-Package.ps1

function Test-Package
{
    <#
        .DESCRIPTION
            Test if a package is registered with Windows
    
        .EXAMPLE
            $TestPackage = Test-Package -Name "Google Chrome"
    
        .NOTES
            Created by: Jon Anderson
            Modified: 2023-07-03
    #>

    [CmdletBinding()]
    param(
        [parameter(Mandatory = $true)][ValidateNotNullOrEmpty()]
        [String]$Name
    )

    $InstalledPackages = Get-Package -AllVersions -Name $Name -ErrorAction SilentlyContinue
    if(!($NULL -eq $InstalledPackages))
    {
        return $true
    }
    else
    {
        return $false
    }
}