<#
.DESCRIPTION
    This script will test existence of registry key, registry entry and
    its value to match with required value and provide the result.
    Author: Jatin Makhija
    Website: cloudinfra.net
    Version: 1.0.0
    Version: 1.0.1 2024-02-25 USa - $valueName added in line 19
#>
#Provide registry key path 
$regPath = "HKLM:\SOFTWARE\Kofax\PDF\V1"
#Provide registry entry display name 
$valueName = "VersionLong"
#Provide registry entry expected value 
$requiredValue = "5.0.0.4.0.22567"
$regkeyexists = Test-Path -Path $regPath
if ($regkeyexists) {
   #Check if registry entry named Status exists
   $regentryexists = Get-ItemProperty -Path $regpath -Name $valueName -ErrorAction SilentlyContinue
   if ($regentryexists) {
   #If registry entry named Status exists, then fetch its value
    $currentValue = Get-ItemProperty -Path $regpath | Select-Object -ExpandProperty $valueName -ErrorAction SilentlyContinue
    #Match Status registry entry value with requied value
    if ($currentValue -eq $requiredvalue) {
            Write-Host "Reg value exists and matching the required value."
        } else {
            Write-Host "Reg value exists, but does not match the required value."
            Write-Host "Current value: $currentValue"
            Write-Host "Required value: $requiredValue"
        }
    } 
    else {
        Write-Host "Registry value does not exist."
    }

else {
    Write-Host "Registry key does not exist."
}