private/Tests/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 Returns $true when Windows ADK 10.1.26100.x (25H2) is installed. .NOTES Author: David Segura Company: Recast Software Detection: Uninstall registry — DisplayName like 'Windows Assessment and Deployment Kit*', DisplayVersion like '10.1.26100.*'. #> [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 Returns $true when the Windows ADK 25H2 WinPE add-on (10.1.26100.x) is installed. .NOTES Author: David Segura Company: Recast Software Detection: Uninstall registry — DisplayName like 'Windows Assessment and Deployment Kit - Windows Preinstallation Environment Add-ons*', DisplayVersion like '10.1.26100.*'. #> [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 Returns $true when Windows ADK 10.1.28000.x (26H1) is installed. .NOTES Author: David Segura Company: Recast Software Detection: Uninstall registry — DisplayName like 'Windows Assessment and Deployment Kit*', DisplayVersion like '10.1.28000.*'. #> [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 Returns $true when the Windows ADK 26H1 WinPE add-on (10.1.28000.x) is installed. .NOTES Author: David Segura Company: Recast Software Detection: Uninstall registry — DisplayName like 'Windows Assessment and Deployment Kit - Windows Preinstallation Environment Add-ons*', DisplayVersion like '10.1.28000.*'. #> [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 } |