I want to check via PowerShell, if a specific product (like "Office" or "Visual Studio") is installed on the target computer, but I can not use any 3rd party PowerShell modules (because I want to give the script to some friends and here the script should work out of the box.
I found this PowerShell script that returns a list of all apps (also the path):
$INSTALLED = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, InstallLocation
$INSTALLED += Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, InstallLocation
$INSTALLED | ?{ $_.DisplayName -ne $null } | sort-object -Property DisplayName -Unique | Format-Table -AutoSize
The only thing I need is to get the file-path (InstallLocation) for a specific product and store this in a Variable. I have no idea, how to perform this.