Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 12.45 minutes in December 2020 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

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.

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. 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

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";

0 Comments

Submit a Comment

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

server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Categories:

Tags: