You should remember that registry values are treated like properties to a registry key so they have no specific path and you cannot use Test-Path to check whether a given registry value exists. Here is a function you can use instead:
Function Test-RegistryValue($regkey, $name) {
Get-ItemProperty $regkey $name -ErrorAction SilentlyContinue |
Out-Null
$?
}
Get-ItemProperty $regkey $name -ErrorAction SilentlyContinue |
Out-Null
$?
}