private/Tests/Test-WindowsAdkPath.ps1

function Test-WindowsAdkPath {
    <#
    .SYNOPSIS
        Returns $true when the Windows ADK installation directory exists on disk.
 
    .DESCRIPTION
        Reads the KitsRoot10 registry value from the Windows Kits Installed Roots
        key and tests whether the path it points to exists on disk.
 
        Returns $false when the registry key is absent, the value is empty, or
        the directory does not exist.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Registry keys checked (64-bit path first):
          HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots
          HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots
        Registry value: KitsRoot10
    #>

    [OutputType([bool])]
    param ()

    $kitsRegPaths = @(
        'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots',
        'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots'
    )

    foreach ($regPath in $kitsRegPaths) {
        $kitsRoot = (Get-ItemProperty -Path $regPath -Name 'KitsRoot10' -ErrorAction SilentlyContinue).KitsRoot10
        if ($kitsRoot -and (Test-Path -Path $kitsRoot)) {
            return $true
        }
    }

    return $false
}