SCCM SQL queries

Count installs per application and version

SQL query for the Configuration Manager database that counts how many computers have each application and version installed.

LanguageSQL
What it does to the systemReads only. It changes nothing.

Before you upgrade or remove software, you need to know how many versions are in use. This query counts them for you.

The result shows one row per application, version and publisher. It shows the number of computers for each row, largest first.

SQL
-- Use '%' to count every application. Use '%Adobe%' to count one product family.
DECLARE @AppName NVARCHAR(255) = '%';

SELECT
    arp.DisplayName0               AS Application,
    arp.Version0                   AS Version,
    arp.Publisher0                 AS Publisher,
    COUNT(DISTINCT arp.ResourceID) AS Computers
FROM v_Add_Remove_Programs arp
WHERE arp.DisplayName0 LIKE @AppName
GROUP BY arp.DisplayName0, arp.Version0, arp.Publisher0
ORDER BY Computers DESC, arp.DisplayName0, arp.Version0;

How to use it

  1. Open SQL Server Management Studio and connect to the site database.
  2. Paste the query into a new query window.
  3. Leave @AppName as '%' to count every application.
  4. Change @AppName to a name with % signs to count one product.
  5. Run the query.

Good to know

  • The count uses distinct computers. A computer with both a 32-bit and a 64-bit entry counts once.
  • The data comes from hardware inventory. Rows with no display name do not match the filter.
installed software software count v_Add_Remove_Programs
✉

Get new articles in your inbox

SCCM guides, AI tools, automation tips — sent when published. No spam.