Public/Test-IsInstalled.TempPoint.ps1
function Test-IsInstalled { <# .SYNOPSIS Check if a program is installed .DESCRIPTION This function queries the 'Uninstall' key in the registry of a Windows computer to see if the named program is installed. It returns a boolean true or false. .PARAMETER Program The name of the program to verify installation. .EXAMPLE PS C:\> Test-IsInstalled -Program <Your Program> .NOTES THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER. #> [CmdletBinding()] [OutputType([System.Boolean])] param ( [Parameter(Mandatory = $true, Position = 0)] [ValidateNotNullOrEmpty()] [String]$Program ) begin { } process { $x86 = ((Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall") | ` Where-Object { $_.GetValue("DisplayName") -like "*$program*" }).Length -gt 0; $x64 = ((Get-ChildItem "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall") | ` Where-Object { $_.GetValue("DisplayName") -like "*$program*" }).Length -gt 0; } end { return $x86 -or $x64; } } #End function Test-IsInstalled |