Reputation: 153
I've tried to use Get-ChildItem to get installed program property information and it does provide some of the information I require but the Installed Location/path is usually blank. Given a program's name/displayname, is there a way reliable way to get the installation path of a Windows Server program (remote to other servers) using Powershell?
Thanks in advance.
Upvotes: 6
Views: 30419
Reputation: 41
You can use these cmdlets
to get the paths:
Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | % { Get-ItemProperty $_.PsPath } | Select DisplayName,InstallLocation | Sort-Object Displayname -Descending
Get-ChildItem HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | % { Get-ItemProperty $_.PsPath } | Select DisplayName,InstallLocation | Sort-Object Displayname -Descending
These show different programs and their locations.
Upvotes: 4
Reputation: 8889
Using Registry:
Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |
% { Get-ItemProperty $_.PsPath } | Select DisplayName,InstallLocation
Using WMI:
Get-WmiObject -Class Win32_Product -Filter 'Name like "%Microsoft Office%"' |
Select Caption,InstallLocation
For Remoting, Through registry it's totally different story, with WMI just add the -ComputerName
Parameter (and make sure you have permissions)
Upvotes: 6