Bobcares

Use PowerShell to find list of installed software quickly

by | Jan 13, 2021

In certain situations, we may need to check the list of installed software and its version and for this, we can make use of PowerShell.

Here at Bobcares, we have seen several such PowerShell related queries as part of our Server Management Services for web hosts and online service providers.

Use PowerShell to find list of installed software quickly

Today, we’ll take a look at how to get the list of all installed software using PowerShell.

PowerShell: Check installed software list locally

Now let’s see how our Support Engineers list the installed software locally.

Generally, we make use of Programs and Features in the Control Panel. Or browse all disk partitions in search of a specific app.

Checking the installed software versions by using PowerShell allows gathering data that we need much quicker.

 

1. Get installed software list with Get-WmiObject

In this method, we simply paste a simple query:

Get-WmiObject -Class Win32_Product

Also, we can filter the data to find specific applications from a single vendor, together with their versions, for example:

Get-WmiObject -Class Win32_Product | where vendor -eq CodeTwo | select Name, Version

This method is quite easy. But it has a downside that it takes quite a while to return the results.

 

2. Query registry for installed software

Another method is querying the registry to get the list of installed software. Here is a short script that returns the list of applications together with their versions:

$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
foreach($obj in $InstalledSoftware){write-host $obj.GetValue('DisplayName') -NoNewline; write-host " - " -NoNewline; write-host $obj.GetValue('DisplayVersion')}

The above command will list all the software installed on the LM – local machine. However, applications can be installed per user as well. So, to return a list of applications of the currently logged user, we change HKLM to HKCU (CU stands for “current user”):

$InstalledSoftware = Get-ChildItem "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
foreach($obj in $InstalledSoftware){write-host $obj.GetValue('DisplayName') -NoNewline; write-host " - " -NoNewline; write-host $obj.GetValue('DisplayVersion')}

 

3. Getting the list of recently installed software from the Event Log

In order to check only the recently installed software, we use the following cmdlet to search through the Event Log.

Get-WinEvent -ProviderName msiinstaller | where id -eq 1033 | select timecreated,message | FL *

 

PowerShell: Get a list of installed software remotely

It is possible to remotely find the list of installed software on other machines. For that, we need to create a list of all the computer names in the network. Here are the different methods that we can use within a Foreach loop to return results from more than a single remote PC.

$pcname in each script stands for the name of the remote computer on which we want to get a list of installed software and their versions.

 

1. Get installed software list with remote Get-WmiObject command

The below cmdlet is the easiest one but can take some time to finish:

Get-WmiObject Win32_Product -ComputerName $pcname | select Name,Version

where $pcname is the name of the computer we want to query.

 

2. Check installed software with remote registry query

Remote registry queries are slightly more complicated and require the Remote Registry service to be running. A sample query is as follows:

$list=@()
$InstalledSoftwareKey="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$InstalledSoftware=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$pcname)
$RegistryKey=$InstalledSoftware.OpenSubKey($InstalledSoftwareKey)
$SubKeys=$RegistryKey.GetSubKeyNames()
Foreach ($key in $SubKeys){
$thisKey=$InstalledSoftwareKey+"\\"+$key
$thisSubKey=$InstalledSoftware.OpenSubKey($thisKey)
$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $pcname
$obj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType NoteProperty -Name "DisplayVersion" -Value $($thisSubKey.GetValue("DisplayVersion"))
$list += $obj
}
$list | where { $_.DisplayName } | select ComputerName, DisplayName, DisplayVersion | FT

 

3. Check recently installed software list from the Event Log remotely

We can check a user’s event log remotely by adding a single attribute (-ComputerName) to the cmdlet used before:

Get-WinEvent -ComputerName $pcname -ProviderName msiinstaller | where id -eq 1033 | select timecreated,message | FL *

 

Check if a GPO-deployed software was applied successfully

If we apply a certain software version via GPO, then we can easily check if this GPO was successfully applied to a user or not. All we need is the GPResult tool and names of the target computer and user:

gpresult /s "PCNAME" /USER "Username" /h "Target location of the
HTML report"

Finally, we look for the GPO name and check if it is present under Applied GPOs or Denied GPOs.

[Need any further assistance with PowerShell queries? – We are here to help you.]

 

Conclusion

Today, we saw how our Support Engineers get the list of all installed software using PowerShell.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

6 Comments

  1. Broc

    Nice one Gayathri, thanks

    Reply
  2. Milind

    Hi,

    I am looking for script which can be run on any server or desktop to know the number of Windows application installed on different VMware virtual desktop and servers.

    Reply
    • Hiba Razak

      Hi,
      Please contact our support through live chat(click on the icon at right-bottom).

      Reply
  3. dp

    Never use “Get-WmiObject -Class Win32_Product” unless you want to update your resume
    This causes software to re-initialize

    Use “Get-Package” instead

    Reply
  4. BSB

    This seems to work well, but it doesn’t appear to grab every application. For instance, when I run this I don’t see Firefox or Notepad++ listed. Are there limitations to this command?

    Reply
    • Hiba Razak

      Hi,
      Please contact our support team through live chat (click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF