Private/New-RegistryKey.ps1

function New-RegistryKey
{
    <#
        .SYNOPSIS
            Creates a registry key.
        .PARAMETER Path
            The path to the registry key to be created.
            Must include the registry hive.
    #>

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

    $parentPath = Split-Path -Path $Path -Parent

    if (-not (Test-RegistryKeyExists -Path $parentPath))
    {
        New-RegistryKey -Path $parentPath
    }

    Write-Verbose -Message "New-RegistryKey - Creating new registry key at: $Path"

    $null = New-Item -Path "Registry::$Path"
}