Endpoint Management and Virtualization Trusted Advisors Community merge into SED TA Community

  • 1.  Reporting on SW Product usage with manufacturer

    Posted Jul 19, 2012 05:34 PM

    Hello,

    I"m trying to provide a report to our SW Asset Mgmt team that includes several fields, namely:

    SerialNumber, CompName, SoftwareProductName, SWProductManufacturer, SW Product "Version", "Detail" version, LastUsed, RunCount

    I used the built-in Software Usage report and managed to get this far:

    
    

    SELECT DISTINCT

    i.Name [Computer], chassis.[Serial Number],

    vsps.CompanyName,

    f.Name [Software_Product],

    MAX (a.[Last Start]) [Last Start],

    SUM(a.[RunCount]) AS RunCount,

    CASE WHEN a._ResourceGuid IS NULL THEN 'No'

    ELSE 'Yes' END AS 'Used [Yes | No]'

    FROM dbo.vSoftwareProduct f

    JOIN vSoftwareProductSearch vsps on f.Guid = vsps.Guid

    JOIN ResourceAssociation ra

    ON ra.ParentResourceGuid = f.Guid

    AND ra.ResourceAssociationTypeGuid = '9D67B0C6-BEFF-4FCD-86C1-4A40028FE483'

    JOIN vSoftwareComponent sc

    ON sc.Guid = ra.ChildResourceGuid

    JOIN dbo.Inv_InstalledSoftware iis

    ON iis._SoftwareComponentGuid = ra.ChildResourceGuid

    AND iis.InstallFlag = 1

    JOIN dbo.vComputer i

    ON i.Guid = iis._ResourceGuid

    JOIN Inv_HW_Chassis chassis ON i.Guid = chassis._ResourceGuid

    LEFT JOIN Inv_Software_Product_Usage spu

    ON spu._ResourceGuid = f.Guid

    LEFT JOIN (SELECT DISTINCT ms.FileResourceGuid, ms._ResourceGuid, ra12.ParentResourceGuid [ParentResourceGuid],

    MAX ([Last Start]) [Last Start], SUM(ms.[Run Count]) AS RunCount FROM dbo.Inv_Software_Execution se

    JOIN dbo.vAMMonthlySummary ms

    ON ms.FileResourceGuid = se._ResourceGuid

    JOIN dbo.ResourceAssociation ra11

    ON ra11.ChildResourceGuid = se._ResourceGuid

    JOIN ResourceAssociation ra12

    ON ra12.ChildResourceGuid = ra11.ParentResourceGuid

    AND ra12.ResourceAssociationTypeGuid = '9D67B0C6-BEFF-4FCD-86C1-4A40028FE483'

    WHERE se.IsMetered = 1

    GROUP BY ms.FileResourceGuid, ms._ResourceGuid, ra12.ParentResourceGuid

    ) a

    ON a.ParentResourceGuid = ra.ParentResourceGuid

    AND a._ResourceGuid = i.Guid

    AND a.[Last Start] BETWEEN GETDATE() - spu.UsageCount and GETDATE()

    WHERE i.[System Type] LIKE 'Win%'

    AND chassis.[Serial Number] IS NOT NULL and chassis.[Serial Number] <> 'None'

    GROUP BY

    i.[Name], chassis.[Serial Number],

    i.[Domain], vsps.CompanyName,

    f.Name,

    CASE WHEN a._ResourceGuid IS NULL THEN 'No' ELSE 'Yes' END

     

    At this point I'm trying to figure out how to get the Version field out of the Software Product (the "9.x" for example in the top of the SW Product configuration screen), along with the actual installed version from Add/Remove Programs, and the binary used for tracking execution.  I just can't dig through the db anymore at the moment.

    Anyone have any ideas (I'm looking at you, @Andrew Bosch)! 



  • 2.  RE: Reporting on SW Product usage with manufacturer

    Posted Jul 20, 2012 09:38 AM

    Should have something for you by EOD :)



  • 3.  RE: Reporting on SW Product usage with manufacturer

    Posted Jul 20, 2012 09:40 AM
    My hero! :)


  • 4.  RE: Reporting on SW Product usage with manufacturer

    Posted Jul 20, 2012 05:40 PM

    Here's a start -- not performance tested yet :)

     

     

    SELECT COALESCE(sn.[Serial Number], ch.[Serial Number]) AS [Serial Number], vc.Name AS Computer, product.Name AS Product, product.Manufacturer, product.[Version], product.[Last Used], product.[Run Count] 
    FROM vComputer vc
    JOIN (SELECT inst._ResourceGuid AS ComputerGuid, sp.Name, company.Name AS [Manufacturer], spv.[Version], MAX(usage.[Last Used]) AS [Last Used], SUM(usage.[Run Count]) AS [Run Count]
          FROM RM_ResourceSoftware_Product sp
          LEFT JOIN Inv_Software_Product_Version spv
             ON spv._ResourceGuid = sp.Guid
          JOIN ResourceAssociation pcc --product contains component
             ON pcc.ParentResourceGuid = sp.Guid
             AND pcc.ResourceAssociationTypeGuid = '9D67B0C6-BEFF-4FCD-86C1-4A40028FE483' --product contains component
          JOIN Inv_InstalledSoftware inst
             ON inst._SoftwareComponentGuid = pcc.ChildResourceGuid
             AND inst.InstallFlag = 1
          LEFT JOIN (SELECT ci.[Name], ra.ParentResourceGuid AS ProductGuid
                     FROM vRM_Company_Item ci
                     JOIN  ResourceAssociation ra
                        ON Guid = ChildResourceGuid 
                     WHERE ra.ResourceAssociationTypeGuid = 'D5C66D5A-7686-4CA2-B7C1-AC980576CE1D') company
             ON company.ProductGuid = sp.Guid
          OUTER APPLY (SELECT SUM(ms.[Run Count]) AS [Run Count],_ResourceGuid, DATEADD(MINUTE, DATEDIFF(MINUTE, GETUTCDATE(), GETDATE()), MAX(ms.[Last Start])) AS [Last Used]
                       FROM ResourceAssociation ccf
                       OUTER APPLY (SELECT ms.[Run Count],ms.[Last Start],_ResourceGuid
                                    FROM vAMMonthlySummary ms
                                    WHERE ms.FileResourceGuid = ccf.ChildResourceGuid) ms
                        WHERE ccf.ParentResourceGuid = pcc.ChildResourceGuid 
                        AND ms._ResourceGuid IS NOT NULL
                        AND ccf.ResourceAssociationTypeGuid = 'EABE86D3-AAFD-487A-AF63-5C95D7511AF6' --component contains file
                     GROUP BY ccf.ParentResourceGuid, _ResourceGuid) usage
          GROUP BY inst._ResourceGuid, sp.Name, company.Name, spv.[Version]) product   
       ON product.ComputerGuid = vc.Guid      
    LEFT JOIN Inv_HW_Chassis ch
       ON ch._ResourceGuid = vc.Guid
    LEFT JOIN Inv_Serial_Number sn
       ON sn._ResourceGuid = vc.Guid
     
    WHERE vc.IsManaged = 1 --Only Active Computers
    ORDER BY vc.Name


  • 5.  RE: Reporting on SW Product usage with manufacturer

    Posted Jul 26, 2012 11:57 AM

    Awesome Andrew, thank you!  Last tweak that I need to add is the actual installed version (per Add/Remove Programs), i.e. for an Adobe Acrobat it would show 9.5.1 as a "Technical Version" (whereas the Product definition just shows 9.x).  I managed to add the executable name(s) to the report by joining Inv_installed_File_Details (still getting used to this new DB schema!) and updating some GROUP BYs.



  • 6.  RE: Reporting on SW Product usage with manufacturer

    Posted Aug 22, 2012 11:10 AM

    Hi Kyle

    Did you ever get the version from Add/Remove programs joined with the usage data?

    Cheers

     

    Kåre



  • 7.  RE: Reporting on SW Product usage with manufacturer

    Posted Aug 22, 2012 03:59 PM
    Hi Kåre, No, I didn't...it has been put on "the back burner" for now...if you are able to add it,please post your code!