0

I am using the command Get-WmiObject -Class Win32_Product in powershell to find the InstallLocation of a software installed in windows. It is showing me no value in it. What is the reason many softwares installed in windows do not have InstallLocation property. How do I get it in powershell?

  • can you be a bit more specific? is there a specific app you're looking for? – Isaac May 25 '20 at 17:48
  • please give a specific example of the code you are running AND the result you are getting. ///// as an aside, please look up `Win32_Product is evil` for alternate methods and why to use them. [*grin*] – Lee_Dailey May 25 '20 at 17:59
  • The msi is developed by me. I installed it then I simply ran Get-WmiObject -Class Win32_Product in powershell. I do find my software in the list but the value of InstallLocation object property for it is showing blank or null. Do I have to make specific change in my msi so that its location gets reflected in Win32_Product? – Zuber Chataiwala May 27 '20 at 10:39

2 Answers2

0

If the results returned by your WMI command does not return your wanted InstallLocation for your wanted app then you might want to check these 2 other options:

Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | % { Get-ItemProperty $_.PsPath } | Select-Object DisplayName, InstallLocation | Sort-Object Displayname -Descending

Get-ChildItem HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | % { Get-ItemProperty $_.PsPath } | Select-Object DisplayName, InstallLocation | Sort-Object Displayname -Descending

SQDix
  • 1
  • The first command did return my msi in the list but InstallLocation was blank. The second command did not even return the msi. This msi is newly developed by me. – Zuber Chataiwala May 26 '20 at 08:46
0

Fullpath or source will have the path:

get-package *whatever*
js2010
  • 23,033
  • 6
  • 64
  • 66
  • Big +1 to Get-Package. Didn't know this existed until recently. Also handles really well with uninstalling cmdlet too – Isaac May 25 '20 at 19:47