private/Test-InstallMDT.ps1

function Test-InstallMDT {
    <#
    .SYNOPSIS
        Tests whether Microsoft Deployment Toolkit is registered as installed
 
    .DESCRIPTION
        Searches the 64-bit and 32-bit machine uninstall registry for a display
        name beginning with Microsoft Deployment Toolkit. Returns $true when a
        matching entry is found; otherwise, returns $false. This function does
        not verify that the installation directory exists.
 
    .EXAMPLE
        PS> Test-InstallMDT
 
        Tests the machine uninstall registry for Microsoft Deployment Toolkit.
 
    .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
 
    .LINK
        Test-MDTInstallDir
    #>

    [OutputType([bool])]
    param ()

    $regPaths = @(
        'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
        'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
    )

    foreach ($regPath in $regPaths) {
        $entry = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue |
            Where-Object { $_.PSObject.Properties['DisplayName'] -and $_.DisplayName -like 'Microsoft Deployment Toolkit*' } |
            Select-Object -First 1
        if ($entry) { return $true }
    }

    return $false
}