private/Test-InstallAdk.ps1

# Helper used only within this file — not exported.
$script:_UninstallRegPaths = @(
    'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
    'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)

function Test-InstallAdk25H2 {
    <#
    .SYNOPSIS
        Tests for a Windows ADK 10.1.26100.x uninstall entry
 
    .DESCRIPTION
        Searches the 64-bit and 32-bit machine uninstall registry for an entry
        whose display name begins with Windows Assessment and Deployment Kit
        and whose display version begins with 10.1.26100. Returns $true when a
        matching entry is found; otherwise, returns $false.
 
    .EXAMPLE
        PS> Test-InstallAdk25H2
 
        Tests the machine uninstall registry for a matching ADK 25H2 entry.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Boolean. Returns $true when a matching uninstall entry is found;
        otherwise, returns $false.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-08-28
 
        This function tests uninstall metadata and does not validate ADK files
        on disk.
 
    .LINK
        Test-InstallAdk25H2WinPE
    #>

    [OutputType([bool])]
    param ()

    foreach ($regPath in $script:_UninstallRegPaths) {
        $entry = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue |
            Where-Object {
                $_.PSObject.Properties['DisplayName'] -and
                $_.DisplayName -like 'Windows Assessment and Deployment Kit*' -and
                $_.PSObject.Properties['DisplayVersion'] -and
                $_.DisplayVersion -like '10.1.26100.*'
            } |
            Select-Object -First 1
        if ($entry) { return $true }
    }

    return $false
}

function Test-InstallAdk25H2WinPE {
    <#
    .SYNOPSIS
        Tests for a Windows ADK 25H2 WinPE add-on uninstall entry
 
    .DESCRIPTION
        Searches the 64-bit and 32-bit machine uninstall registry for an entry
        whose display name begins with Windows Assessment and Deployment Kit -
        Windows Preinstallation Environment Add-ons and whose display version
        begins with 10.1.26100. Returns $true when a matching entry is found;
        otherwise, returns $false.
 
    .EXAMPLE
        PS> Test-InstallAdk25H2WinPE
 
        Tests the machine uninstall registry for a matching ADK 25H2 WinPE
        add-on entry.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Boolean. Returns $true when a matching uninstall entry is found;
        otherwise, returns $false.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-08-28
 
        This function tests uninstall metadata and does not validate WinPE
        add-on files on disk.
 
    .LINK
        Test-InstallAdk25H2
    #>

    [OutputType([bool])]
    param ()

    foreach ($regPath in $script:_UninstallRegPaths) {
        $entry = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue |
            Where-Object {
                $_.PSObject.Properties['DisplayName'] -and
                $_.DisplayName -like 'Windows Assessment and Deployment Kit - Windows Preinstallation Environment Add-ons*' -and
                $_.PSObject.Properties['DisplayVersion'] -and
                $_.DisplayVersion -like '10.1.26100.*'
            } |
            Select-Object -First 1
        if ($entry) { return $true }
    }

    return $false
}

function Test-InstallAdk26H1 {
    <#
    .SYNOPSIS
        Tests for a Windows ADK 10.1.28000.x uninstall entry
 
    .DESCRIPTION
        Searches the 64-bit and 32-bit machine uninstall registry for an entry
        whose display name begins with Windows Assessment and Deployment Kit
        and whose display version begins with 10.1.28000. Returns $true when a
        matching entry is found; otherwise, returns $false.
 
    .EXAMPLE
        PS> Test-InstallAdk26H1
 
        Tests the machine uninstall registry for a matching ADK 26H1 entry.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Boolean. Returns $true when a matching uninstall entry is found;
        otherwise, returns $false.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-08-28
 
        This function tests uninstall metadata and does not validate ADK files
        on disk.
 
    .LINK
        Test-InstallAdk26H1WinPE
    #>

    [OutputType([bool])]
    param ()

    foreach ($regPath in $script:_UninstallRegPaths) {
        $entry = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue |
            Where-Object {
                $_.PSObject.Properties['DisplayName'] -and
                $_.DisplayName -like 'Windows Assessment and Deployment Kit*' -and
                $_.PSObject.Properties['DisplayVersion'] -and
                $_.DisplayVersion -like '10.1.28000.*'
            } |
            Select-Object -First 1
        if ($entry) { return $true }
    }

    return $false
}

function Test-InstallAdk26H1WinPE {
    <#
    .SYNOPSIS
        Tests for a Windows ADK 26H1 WinPE add-on uninstall entry
 
    .DESCRIPTION
        Searches the 64-bit and 32-bit machine uninstall registry for an entry
        whose display name begins with Windows Assessment and Deployment Kit -
        Windows Preinstallation Environment Add-ons and whose display version
        begins with 10.1.28000. Returns $true when a matching entry is found;
        otherwise, returns $false.
 
    .EXAMPLE
        PS> Test-InstallAdk26H1WinPE
 
        Tests the machine uninstall registry for a matching ADK 26H1 WinPE
        add-on entry.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Boolean. Returns $true when a matching uninstall entry is found;
        otherwise, returns $false.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-08-28
 
        This function tests uninstall metadata and does not validate WinPE
        add-on files on disk.
 
    .LINK
        Test-InstallAdk26H1
    #>

    [OutputType([bool])]
    param ()

    foreach ($regPath in $script:_UninstallRegPaths) {
        $entry = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue |
            Where-Object {
                $_.PSObject.Properties['DisplayName'] -and
                $_.DisplayName -like 'Windows Assessment and Deployment Kit - Windows Preinstallation Environment Add-ons*' -and
                $_.PSObject.Properties['DisplayVersion'] -and
                $_.DisplayVersion -like '10.1.28000.*'
            } |
            Select-Object -First 1
        if ($entry) { return $true }
    }

    return $false
}