Test whether Registry Value exists

by Apr 8, 2010

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 |

Twitter This Tip! ReTweet this Tip!