Private/Test-RegistryKeyExists.ps1

function Test-RegistryKeyExists
{
    <#
        .SYNOPSIS
            Tests if a registry key exists.
        .PARAMETER Path
            The path to the registry key to test for existence.
            Must include the registry hive.
    #>

    [CmdletBinding()]
    [OutputType([Boolean])]
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [String]
        $Path
    )

    return Test-Path -Path "Registry::$Path"
}