Getting All Machines Containing a Specific Software Package

So, Let’s say you need to see all machines that contain a specific software package, you can use sccm’s gui, or you can do it in SQL, where you can act on the results:

 
declare @LookupString as nvarchar 
set @LookupString = '%'
 
SELECT     vrs.Name0
FROM       v_r_system AS vrs 
JOIN   v_GS_INSTALLED_SOFTWARE AS VIS ON VIS.resourceid = vrs.resourceid 
JOIN  v_GS_SoftwareFile AS sf ON SF.resourceid = vrs.resourceid                         
WHERE     VIS.productname0 LIKE @LookupString
GROUP BY vrs.Name0

NAME0

LSEU0778
LSTW0631
MACS4268
LSAM9049
LSGR0590
Advertisements