Finding ALL installed applications with PowerShell?
Asked Answered
A

4

4

I am trying to use Windows PowerShell 2.0 to find an installed application. I have tried two methods, one using WMI and one using the Registry. Both methods are able to bring up a large list of installed applications and components, however neither one seems to bring up the application I am interested in.

I am specifically looking for CruiseControl.NET. It appears in the list of applications in the Programs and Features control panel applet. I know for a fact that it is currently installed, since I just uninstalled and reinstalled it to start fresh. Neither of the following methods seem to work, however (they succeed, but return no results):

Registry Search Approach

Looks in the registry HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall for application keys. Returns plenty if I remove the where, but it is missing quite a few applications that do appear in the windows programs and features control panel.

gci "hklm:\software\microsoft\windows\currentversion\uninstall" 
    | foreach { gp $_.PSPath } 
    | select DisplayVersion,InstallDate,ModifyPath,Publisher,UninstallString,Language,DisplayName 
    | where { $_.DisplayName -match "^Cruise*" }

WMI Approach

Also returns plenty, however, based on the documentation for the Win32_Product object, they are only MSI installed applications. Many applications are missing, I'm guessing because they are not MSI. The CruiseControl.NET installer is the NSIS (NullSoft Installation System)...since it doesn't appear here, I am guessing that it doesn't use MSI at all, however I am curious if there is another way to use WMI to find ANY/ALL installed applications, regardless of whether they used MSI or not.

gwmi -namespace "root\cimv2" -class "Win32_Product" 
    | select Name,Vendor,Version,IdentifyingNumber 
    | where { $_.Name -match "^Cruise*" }

Finding the application via the registry does not do me a whole lot of good, really. Unless it also provides some way to find the applications uninstaller and the correct parameters to invoke it, which does not appear to always be the case. I would prefer to use WMI to find and uninstall the applications I need to uninstall, as that would not only allow me to use a single management interface for all of my scripts (WMI), but it should be easy for others to figure out how to maintain the scripts in the future since WMI is generally well documented.

Arlinearlington answered 11/2, 2010 at 18:39 Comment(1)
This wouldn't fix your problem, but your regex isn't doing what you think it is: "^Cruise*" would match "Cruis" or "Cruiseeeee" (and also "CruiseControl.NET") but if you were just looking for anything starting with "Cruise" you can simply use "^Cruise". To be more explicit, you could use "^Cruise.*" but it's not necessary.Astrahan
A
7

Well, sorry to do this again. I had a bad habit of answering my own questions.

Anyway, I found the answer to my question by searching the registry for "CruiseControl.NET". It seems that 64bit versions of windows store Uninstall information in multiple places. Most notably, uninstall information seems to be primarily aggregated at the following key:

HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\

I was able to find every program on my system listed here, including CruiseControl.NET. Note that this only seems to be the case on 64bit Windows Systems.

Arlinearlington answered 12/2, 2010 at 17:50 Comment(2)
jrista, answering your own questions is NOT a bad habit.Pesticide
I still cant find many programs using this, for example photoshop..Mb
M
3

I found this online it's magic, use in admin mode

Get-WMIObject Win32_InstalledWin32Program | select Name, Version, ProgramId

Masquer answered 16/7, 2020 at 11:9 Comment(1)
Use Get-CimInstance -ClassName instead. It uses WinRM and is encrypted by default.Kamkama
R
2

The below command finds CruiseControl.Net:

gci "HKLM:\software\Microsoft\windows\CurrentVersion\Uninstall" | %{ gp $_.PSPath } | where { $_.DisplayName -match "CruiseControl.NET" }

I can't honestly answer you about if the UninstallString is always present when searching the Uninstall Registry, nor can I tell you if you will find all applications installed on your machine. I know here MS gives instructions on a manual uninstall, which uses the UninstallString from this registry entry, so.. I am sure someone with more knowledge on the subject will comment..

Edit: Results on a Windows 7 Machine

PSPath            : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\Microsoft\windows\CurrentVersion\Uninstall\CruiseControl.NET
PSParentPath      : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\Microsoft\windows\CurrentVersion\Uninstall
PSChildName       : CruiseControl.NET
PSProvider        : Microsoft.PowerShell.Core\Registry
NSIS:StartMenuDir : CruiseControl.NET
CCNetVDir         : 1
DisplayName       : CruiseControl.NET 1.5.6804.1
UninstallString   : C:\Program Files\CruiseControl.NET\uninst.exe
DisplayIcon       : C:\Program Files\CruiseControl.NET\Server\ccnet.exe
DisplayVersion    : 1.5.6804.1
URLInfoAbout      : http://ccnet.thoughtworks.com/
Publisher         : ThoughtWorks
Rang answered 11/2, 2010 at 21:23 Comment(3)
I tried the above command, however it also returns nothing. I am using Windows 7, I am not sure if that plays a factor. For some reason, the version of CruiseControl.NET that I am installing refuses to show up anywhere but the Programs and Features control panel. There are also numerous other programs, such as VLC and Wireshark, that also do not appear in either the registry or wmi commands.Arlinearlington
@Arlinearlington - I edited the above post and pasted the results from the command on a Windows 7 machine. When you browse the registry with regedit do you see the entry?Rang
I actually don't see it in the registry. My Uninstall key in the registry contains a ton of guid keys, which mostly contain Microsoft stuff like Visual Studio, SQL Server, etc. Some Adobe things are in there as well. No sign of CruiseControl.NET however, but interestingly enough, it still shows up in the Programs/Features cpl. I can uninstall it from there as well, and it works. I'm just not sure where its getting the info from.Arlinearlington
E
0

I am using such PowerShell command to list all installed software (both 32bit/64bit).

Get-ItemProperty -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" |where { $_.DisplayName -ne $null } | Select-Object DisplayName, DisplayVersion, InstallDate

In my case WMI object list was missing for example Nvidia installed software.

And Slack and teams are added to HKCU property:

DisplayName    : Slack
DisplayVersion : 4.19.3
InstallDate    : 20210830
Publisher      : Slack Technologies Inc.
PSDrive        : HKCU

DisplayName    : Microsoft Teams
DisplayVersion : 1.4.00.22976
InstallDate    : 20210921
Publisher      : Microsoft Corporation
PSDrive        : HKCU
Erbes answered 21/9, 2021 at 8:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.