Querying SCCM – Finding Manufacturer Counts and Percentages


Lately I've been doing a lot of work with System Center Configuration Manager (SCCM) 2012 in terms of reporting and custom collections. As part of this, I've had the need to write this particular short query to retrieve manufacturer details several times, which seemed to make for a good target to share.

Goal: Find the number of machines (count) in the environment by manufacturer, including the percentage of the total.

SELECT  Manufacturer0 as Manufacturer,
COUNT(Manufacturer0) AS ManufacturerCount,
    CAST(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER () AS DECIMAL(18,2)) as PercentageRounded,
    COUNT(*) * 100.0 / SUM(COUNT(*)) OVER () as PercentagePrecise
FROM dbo.v_GS_COMPUTER_SYSTEM
GROUP BY Manufacturer0
ORDER BY COUNT(Manufacturer0) DESC

 

ManufacturerPercentages

Thanks,
Sam Lester (MSFT)

Comments (0)

Skip to main content