How to find installed software on remote Windows systems with PowerShell

Contents

Powershell logo

If you are an IT administrator, it is very likely that you had to install software for others. Terminal management is big business these days, and software maintenance on hundreds or hundreds of computers is common in large institutions. Despite this, big business usually means a lot of money.

What if you are in an organization with little or no budget? Maybe you or someone on your team has gotten into using PowerShell to automate various tasks? Then, Using PowerShell to manage software on many endpoints at the same time can be beneficial.

The PowerShell scripting language is a powerful flexible language that seems to handle almost anything in a Windows environment. Working with software on remote computers is a piece of cake!!

In this post, you will learn how you can use PowerShell to create reports on installed software. Even though PowerShell is also capable of installing software, focus on consulting software that has been installed by other means.

Where the software is registered

The term “software” is a vague definition, especially on Windows. When installing a software package, It is entirely up to the software developer to determine what changes to the user's computer. Software installers copy files, create registry keys, add WMI instances and more. The key to creating an accurate software inventory report, regardless of method, is to understand first what to look for.

Even though the installed software is registered in WMI, a more reliable way to find this information is to use the registry.

Each modern version of Windows stores the information of the installed software in the three registry keys below. Depending on how the software was installed, it is always stored as a registry key under one of these primary keys.

  • HKEY_LOCAL_MACHINE (route of 32 bits)
  • HKEY_LOCAL_MACHINE6432Node (route of 64 bits)
  • HKEY_CURRENT_USER (for each user profile)

Each secondary registry key in these primary keys is generally named after the global unique identifier (GUID) of the software. Inside that key, you can find registry values ​​for the software title, the version and more.

Remote PC requirements

To use the code covered in this post, I assume you have PowerShell Remoting enabled and available on your remote computers. You can test PowerShell Remoting by trying to run a simple command like Invoke-Command -ComputerName REMOTEPCNAME -ScriptBlock {1}. If this fails, the rest of the information covered in this post won't work either.

To avoid re-creating the wheel and creating your own PowerShell tool, let's use an existing one. Some time ago I created a PowerShell module called PSSoftware that solves this problem well.

First, in a PowerShell administrative console, download and install the PSSoftware PowerShell module from the PowerShell Gallery by running Install-Module PSSoftware.

Once you have the module installed, inspect available commands by running Get-Command -Module PSSoftware -Noun Software. You will see some commands like Get-InstalledSoftware, Install-Software ,and Remove-Software. These commands are the main functions for managing the software. In this post, I focus on the Get-InstalledSoftware function.

Try the Get-InstalledSoftware command running it locally first without parameters. You will immediately see many different software packages flying.

PS51> Get-InstalledSoftware

ModifyPath          : MsiExec.exe /I{4CF4DB38-0692-4A5B-BCE8-1667C51E8416}
VersionMajor        : 14
Version             : 14.0.500.272
sEstimatedSize2     : 732
URLInfoAbout        :
NoRepair            : 1
InstallSource       : C:ProgramDataPackage Cache{4CF4DB38-0692-4A5B-BCE8-1667C51E8416}v14.0.500.272x64
Contact             :
Size                :
InstallLocation     :
VersionMinor        : 0
SystemComponent     : 1
EstimatedSize       : 1464
URLUpdateInfo       :
InstallDate         : 20170716
Comments            :
WindowsInstaller    : 1
HelpLink            : https://go.microsoft.com/fwlink/?LinkId=154582
UninstallString     : MsiExec.exe /I{4CF4DB38-0692-4A5B-BCE8-1667C51E8416}
GUID                : {4CF4DB38-0692-4A5B-BCE8-1667C51E8416}
HelpTelephone       :
Readme              : Placeholder for ARP readme in case of no UI
Publisher           : Microsoft Corporation
Language            : 1033
Name                : SQL Server vNext CTP2.0 XEvent
AuthorizedCDFPrefix :
PSComputerName      : MACWINVM
RunspaceId          : da83572b-150b-43b6-923a-14e516a77ba3
--snip--

You can limit that output to just the title and version using the Select-Object cmdlet.

PS51> Get-InstalledSoftware | Select-Object -Property Name,Version

To query a remote computer, use el ComputerName parameter. The same software packages are returned.

You may prefer not to see all installed software, but only software that matches a specific title. You can filter this information using the Where-Object cmdlet. The following example finds all software that starts with SQL on the remote computer.

PS51> Get-InstalledSoftware | Where-Object {$_.Name -like 'SQL*'} | Select-Object -Property Name,Version

Summary

Once you understand where the installed software is stored and can access it with PowerShell, the world is your oyster. From here, you can quickly expand this code to multiple computers, looking for numerous packages and more.

Using free community PowerShell modules is a great way to create low-cost software inventor reports.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.