private/Tests/Test-InstallMDT.ps1
|
function Test-InstallMDT { <# .SYNOPSIS Returns $true when Microsoft Deployment Toolkit is installed. .NOTES Author: David Segura Company: Recast Software Detection: Uninstall registry — DisplayName like 'Microsoft Deployment Toolkit*'. Dependencies: Windows Features: MDT #> [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 } |